WITH T AS ( SELECT '경역기획' AS DEPT_NAME, '200' AS MANAGER_ID FROM DUAL UNION SELECT '경영' AS DEPT_NAME, '201' AS MANAGER_ID FROM DUAL UNION SELECT 'IT' AS DEPT_NAME, NULL AS MANAGER_ID FROM DUAL UNION SELECT '물류' AS DEPT_NAME, NULL AS MANAGER_ID FROM DUAL UNION SELECT '회계' AS DEPT_NAME, '204' AS MANAGER_ID FROM DUAL ) SELECT * FROM T ORDER BY MANAGER_ID NULLS FIRST; WITH T AS ( SELECT '경역기획' AS DEPT_NAME, '200' AS MANAGER_ID FROM DUAL UNION SELECT '경영' AS DEPT_NAME, '201' AS MANAGER_ID FROM DUAL UNION SELECT 'IT' AS DEPT_NAME, NULL AS MANAGER_ID FROM DUAL UNION SELECT '물류' AS DEPT_NAME, NULL AS MANAGER_ID FROM DUAL UNION SELECT '회계' AS DEPT_NAME, '204' AS MANAGER_ID FROM DUAL ) SELECT * FROM T ORDER BY MANAGER_ID NULLS LAST;
728x90
반응형
'DB > Oracle' 카테고리의 다른 글
오라클 PIVOT/UNPIVOT (0) | 2018.02.15 |
---|---|
오라클 rollup (0) | 2018.02.15 |
오라클 사용자 예외처리 사용 방법 (0) | 2018.02.15 |
oracle 열을 행으로 (, 구분) (0) | 2018.02.15 |
oracle 조인으로 삭제하기 (0) | 2018.02.15 |