表名称为NOTES, 列NAMES = ID,日期,代码,文本
ID DATE CODE TEXT
1 7/24/2013 CD1 HELLO
1 7/24/2013 CD1 STACK OVER FLOW
2 1/24/2000 CD2 PLEASE HELP ME
2 1/24/2000 CD2 THANK YOU
2 1/24/2000 CD2 VERY MUCH
我的要求:oracle SQL LOGIC
ID DATE CODE TEXT
1 7/24/2013 CD1 HELLO, STACK OVER FLOW
2 1/24/2000 CD2 PLEASE HELP ME, THANK YOU, VERY MUCH
答案 0 :(得分:2)
尝试
SELECT
ID,
DATE,
CODE,
LISTAGG(TEXT, ',') WITHIN GROUP (ORDER BY CODE)
FROM NAMES
GROUP BY ID, DATE, CODE