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

 

原文地址:https://www.cnblogs.com/zengwangjing/p/15479182.html