sql >> Base de Datos >  >> RDS >> Oracle

SSIS:Oracle Múltiples filas a una salida de columna sin STRAGG

Hay varias formas de realizar la agregación de cadenas para producir una lista separada por comas; consulte this enlace para más detalles . Según el ejemplo del enlace, intente:

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;