WITH t AS( SELECT 1 AS sno,1 AS cno,5 AS grade FROM dual UNION ALL SELECT 1,2,6 FROM dual UNION ALL SELECT 1,3,10 FROM dual UNION ALL SELECT 2,10 FROM dual UNION ALL SELECT 3,1,9 FROM dual UNION ALL SELECT 3,9 FROM dual) SELECT a.sno,Max(a.aa) FROM (SELECT sno,wm_concat(cno || ',' || grade) over(partition BY sno order by cno,grade) AS aa FROM t) a GROUP BY a.sno;
运行一下就知道是啥意思了
原文链接:https://www.f2er.com/oracle/207338.html