oracle wm_concat 和 listagg函数

来源:互联网 发布:python windows 界面 编辑:程序博客网 时间:2024/05/21 09:00


wm_concat 和listagg 函数都可以实现对(单个或组合)列的合并,也可以看成是对某一列的“SUM”

这俩个函数功能相同,listagg是在11.2的版本中才首次出现的,wm_concat在12c版本中被取消,


      比如:select t.job,wm_concat(t.ename) from scott.emp t group by t.job

    select t.job,listagg(t.ename,',')  within group(order by null) from scott.emp t group by  t.job;



          listgg(column_name,',') within group(order by 某一列)  如果不需要排序,可使用order by null


得出的效果如下:


          

0 0
原创粉丝点击