728x90
Postgresql 콤마로 구분된 데이터 열을 행으로 변환
SQL
with temp01 as (
select 1 as idx
, '가,나,다' as col01
union
select 2 as idx
, '라,마,바' as col01
)
select idx,
unnest(string_to_array(col01, ',')) as col01
from temp01
order by idx asc;
출처 : https://medium.com/swlh/three-routes-convert-comma-separated-column-to-rows-c17c85079ecf
728x90
'DB > Postgres' 카테고리의 다른 글
Postgresql SSL 적용 (0) | 2023.04.03 |
---|---|
postgresql 주말을 제외한 한 달의 모든 요일 얻기 (0) | 2023.03.29 |
Postgresql 15 user create 유저생성 (0) | 2023.03.29 |