आप सूची का उपयोग कर सकते हैं LISTAGG
DECODE
. के साथ कार्य करें :
SELECT NAME, NO,
LISTAGG(DECODE(RODZ_ST,'JEW',IDENT_ST,NULL), ',') WITHIN GROUP (ORDER BY t.ID DESC, RODZ_ST) AS JEWS,
LISTAGG(DECODE(RODZ_ST,'DZE',IDENT_ST,NULL), ',') WITHIN GROUP (ORDER BY t.ID , RODZ_ST) AS DZE,
LISTAGG(DECODE(RODZ_ST,'OBR',IDENT_ST,NULL), ',') WITHIN GROUP (ORDER BY t.ID , RODZ_ST) AS OBR
FROM ORDERS o
LEFT JOIN TYPES t ON t.ID_PR = o.ID_ZM
GROUP BY NAME, NO;