💡
listagg
: 가로로 출력하는 함수
listagg 함수에는 group by 필수
💡
LISTAGG(대상컬럼명, '구분자') WITHIN GROUP (ORDER BY 정렬기준컬럼)
select deptno, listagg(ename, ',') within group (order by ename)
from emp
group by deptno;
select job, listagg(ename, ',') within group (order by ename)
from emp
group by job;
KT 000(25), 000(24), 000(23) ...
LG 000(25), 000(24), 000(23) ...
SKT 000(25), 000(24), 000(23) ...
select telecom, listagg(ename || '(' || age || ')', ',') within group (order by age desc)
from emp21
group by telecom;