listagg( ) within group ( order by ) 与 wm_concat
--oracle 11g 及以后适合 最好
select spbywslid,listagg(xm,',') within group (order by spbywslid) col_name from tpg_jtcyqk group by spbywslid;
--oracle 10g 及以前版本用
select spbywslid,wm_concat(xm)xm from tpg_jtcyqk group by spbywslid;
select deptno,wm_concat(ename)name,count(*)rs from emp group by deptno
select deptno,listagg(ename,',') within group (order by ename ) aa from emp group by deptno
select deptno,listagg(ename,',') within group (order by ename ) aa,count(*)bb from emp group by deptno