Oracle 列数据转换行wm_concat,listagg

两种方法:

 

1.wm_concat  适用于12C以下版本,例如11G,10G

select wm_concat(eb_lifetypeid) province_no from eb_lifetypevipdetail 

 

 2.listagg 通用版本,如果去重加distinct在19c之后版本才能适用
 select  listagg(EB_LIFETYPEID, ',') within group(order by EB_LIFETYPEID)  province_no  from eb_lifetypevipdetail

 

 

 

posted @ 2021-10-29 10:21  会飞的小鲸鱼  阅读(345)  评论(0编辑  收藏  举报