728x90
반응형
위 사진처럼 여러개의 행을 하나의 행으로 표현하기
with school as (
select '1' as grade,'1' as class, '홍길동(1)' as name, 70 as score from dual union all
select '1','1','홍길동(4)',10 from dual union all
select '2','1','홍길동(5)',50 from dual union all
select '2','1','홍길동(7)', 15 from dual union all
select '2','2','홍길동(8)',90 from dual union all
select '3','1','홍길동(2)',54 from dual union all
select '3','1','홍길동(6)',60 from dual union all
select '3','2','홍길동(3)',72 from dual union all
select '3','2','홍길동(9)',0 from dual
) SELECT array_to_string(array_agg(name),',') from school;
// array_to_string(array_agg('컬럼명'),'구분자')
select array_to_string(array_agg(column),',') from daul;
728x90
반응형
'Study > PostgreSQL' 카테고리의 다른 글
postgresql 소숫점 2자리 (0) | 2023.04.25 |
---|---|
[postgreSQL] 날짜/시간 함수 (1) | 2023.04.11 |
[PostgreSQL] COALESCE 함수 (Null 체크) (0) | 2022.11.25 |
[PostgreSQL] EXISTS 연산자 (0) | 2022.09.28 |
[PostgreSQL] WITH 절 (1) | 2022.09.21 |
댓글