정렬 문의 드립니다
WITH T AS (
SELECT 'A' AS GBN, '20170316130200' AS STA_DT, '20170316130700' AS END_DT FROM DUAL UNION ALL
SELECT 'B' , '20170316130200' , '20170316131400' FROM DUAL UNION ALL
SELECT 'C' , '20170316130200' , '20170316134000' FROM DUAL UNION ALL
SELECT 'D' , '20170316130200' , '20170316142400' FROM DUAL UNION ALL
SELECT 'E' , '20170316130200' , '20170316153300' FROM DUAL UNION ALL
SELECT 'F' , '20170316130700' , '20170316132600' FROM DUAL UNION ALL
SELECT 'G' , '20170316131400' , '20170316153300' FROM DUAL UNION ALL
SELECT 'H' , '20170316132600' , '20170316133600' FROM DUAL UNION ALL
SELECT 'I' , '20170316133600' , '20170316142000' FROM DUAL UNION ALL
SELECT 'J' , '20170316134000' , '20170316135300' FROM DUAL UNION ALL
SELECT 'K' , '20170316135300' , '20170316140900' FROM DUAL UNION ALL
SELECT 'L' , '20170316142000' , '20170316142700' FROM DUAL UNION ALL
SELECT 'M' , '20170316142400' , '20170316143400' FROM DUAL UNION ALL
SELECT 'N' , '20170316142700' , '20170316143300' FROM DUAL UNION ALL
SELECT 'O' , '20170316143300' , '20170316143700' FROM DUAL UNION ALL
SELECT 'P' , '20170316143400' , '20170316144800' FROM DUAL UNION ALL
SELECT 'Q' , '20170316153300' , '20170316153800' FROM DUAL
)
SELECT *
FROM T;
=================================================================================================
GBN STA_DT END_DT
A, 20170316130200, 20170316130700
F, 20170316130700, 20170316132600
H, 20170316132600, 20170316133600
I, 20170316133600, 20170316142000
L, 20170316142000, 20170316142700
B, 20170316130200, 20170316131400
G, 20170316131400, 20170316153300
Q, 20170316153300, 20170316153800
C, 20170316130200, 20170316134000
J, 20170316134000, 20170316135300
K, 20170316135300, 20170316140900
D, 20170316130200, 20170316142400
M, 20170316142400, 20170316143400
P, 20170316143400, 20170316144800
E, 20170316130200, 20170316153300
N, 20170316142700, 20170316143300
O, 20170316143300, 20170316143700
이렇게 정렬 될 수 있도록 도움 부탁드립니다.
|