一、oracle查询分组显示分组显示
oracle 中与mysql中group concat同样作用的函数
LISTAGG(ID, ',') WITHIN GROUP(ORDER BY ID) AS ids
举例:
-- 示例
select CHANNEL_ID, LISTAGG(ID, ',') WITHIN GROUP(ORDER BY ID) AS ids
from EDU_APP_CHANNEL_POSITION group by CHANNEL_ID
2、oracle查询数据组合json
SELECT '{"'||LISTAGG(OVERVIEW_NODE, '","') WITHIN GROUP(ORDER BY OVERVIEW_NODE) || '"}' AS OVERVIEW_NODE FROM (SELECT (CURRENTSTEP || '":"' || NODE) AS OVERVIEW_NODE FROM SGJ4Z0.PROCESS_INFO WHERE BATCHRECORDID ='3d3c3a65-f3bf-4b1d-a230-06555660186c' ORDER BY CURRENTSTEP)