-2

名为 NOTES 的表名,列 NAMES = ID,Date,code,text

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  
4

1 回答 1

2

尝试

SELECT 
ID,
DATE,
CODE,
LISTAGG(TEXT, ',') WITHIN GROUP (ORDER BY CODE)
FROM NAMES
GROUP BY ID, DATE, CODE
于 2013-07-24T18:18:54.127 回答