PostgreSQL 문자 + 숫자 데이터 정렬

정영훈·2022년 9월 28일
0

일을 기록하다

목록 보기
19/23

postgresql 에서 column 값이 숫자 + 한글 조합일때 정렬을 변경하는 쿼리이다.
위 아래 순서를 바꿔서 적용해봐도 된다.

NULLIF(regexp_replace(group_name, '\D', '', 'g'), '')::int,
NULLIF(regexp_replace(group_name, '[0-9]', '', 'g'), '') 

프로그래밍 노트 님의 블로그에서 참고하였다.

출처 - https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=anytimedebug&logNo=221317461262

profile
I ❤ JavaScript

0개의 댓글