如何使用derby数据库连接一列中的多行

时间:2018-08-12 10:44:08

标签: java sql concatenation derby

SELECT DISTINCT sec.fileEntry_id,
                sec.scene_id,
                sec.name,
                sec.KholaseSecance,
                sec.honarvar,
                sec.mavaredKhas,
                sec.numberKhatSecance,
                (CASE
                     WHEN cod.name = 'خارجی' THEN secObj.text
                     ELSE NULL
                 END) AS "khareji",
                (CASE
                     WHEN cod.name = 'داخلی' THEN secObj.text
                     ELSE NULL
                 END) "dakhali",
                (CASE
                     WHEN cod.name = 'روز' THEN secObj.text
                     ELSE NULL
                 END) "roz",
                (CASE
                     WHEN cod.name = 'شب' THEN secObj.text
                     ELSE NULL
                 END) "shab",
                (CASE
                     WHEN cod.name = 'بازیگراصلی' THEN secObj.text
                     ELSE NULL
                 END) "bazigarasli",
                (CASE
                     WHEN cod.name = 'بازیگرفرعی' THEN secObj.text
                     ELSE NULL
                 END) "bazigarfarie",
                (CASE
                     WHEN cod.name = 'لوکیشن اصلی' THEN secObj.text
                     ELSE NULL
                 END) "locationasli",
                (CASE
                     WHEN cod.name = 'لوکیشن فرعی' THEN secObj.text
                     ELSE NULL
                 END) "locationfarie",
                (CASE
                     WHEN cod.name = 'وسایل نقلیه' THEN secObj.text
                     ELSE NULL
                 END) "vasaielnaglie",
                (CASE
                     WHEN cod.name = 'وسایل صحنه' THEN secObj.text
                     ELSE NULL
                 END) "vasaielsahne"
FROM CODDING cod
INNER JOIN SCENEOBJECT secObj ON cod.codding_id=secObj.codding_id
INNER JOIN SCENE sec ON sec.scene_id=secObj.scene_id
WHERE sec.fileEntry_id=1
ORDER BY sec.scene_id ASC;

0 个答案:

没有答案