Oracle列转行函数listagg使用演示

有如下数据:

 

 

 使用listagg函数转化后结果:

 

 sql:

SELECT
    TPID_ID,
    listagg ( PART_CODE, ',' ) WITHIN GROUP ( ORDER BY PART_CODE ) AS PART_CODE 
FROM
    TT_PPAP_INIT_DTL_EXT 
WHERE
    TPID_ID = 1663 
GROUP BY
    TPID_ID;
posted @ 2020-01-20 09:48  AlphaJunS  阅读(238)  评论(0编辑  收藏  举报