LISTAGG 함수
-
[ORACLE] LISTAGG함수DATABASE 2018. 11. 6. 15:26
LISTAGG( 컬럼A, 구분자 ) WITHIN GROUP ( ORDER BY 컬럼B): 컬럼A의 값들을 [구분자]와 같이 컬럼B의 기준으로 정렬하여 한 행으로 보여주는 함수로 예시select * from APPARTwhere apgrade='907' 1. 각 원별로 학과 보여주기 select apdiv, listagg( apdept, ' ; ' ) within group (order by apno )from APPARTwhere apgrade='907'group by apdiv select apdiv, listagg( apdept, ' ; ' ) within group (order by apno desc ) --- apno의 내림차순으로from APPARTwhere apgrade='907'group b..