Oracle listagg() WITHIN GROUP () 将多行合并成一行
1. 基本数据
SELECT * FROM emp WHERE deptno='10'
2. 使用 listagg() WITHIN GROUP () 将多行合并成一行
SELECT deptno, listagg(ename, ',') WITHIN GROUP(ORDER BY ename) names
FROM emp
WHERE deptno = '10'
GROUP BY deptno