Ada berbagai cara untuk melakukan agregasi string untuk menghasilkan daftar yang dipisahkan koma - lihat ini tautan untuk detail lebih lanjut . Berdasarkan contoh di tautan, coba:
SELECT x.id,
LTRIM(MAX(SYS_CONNECT_BY_PATH(x.language,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
FROM (SELECT a.id,
b.language,
ROW_NUMBER() OVER (PARTITION BY a.id ORDER BY b.language) AS curr,
ROW_NUMBER() OVER (PARTITION BY a.id ORDER BY b.language) -1 AS prev
FROM TABLE_1 a
JOIN TABLE_2 b ON b.id = a.langid) x
GROUP BY x.id
CONNECT BY prev = PRIOR curr AND x.id = PRIOR x.id
START WITH curr = 1;