with a as ( select 'A' as COL1, 'B' AS COL2 from dual union all select 'A' as COL1, 'C' AS COL2 from dual union all select 'B' as COL1, 'D' AS COL2 from dual ) select * from a;
위 결과 좋은 방법 확인좀 해주세요 ^^
by 디케이
[2013.06.03 09:53:13]
select col1 AS COL3 from a union select col2 AS COL3 from a
by 김성수
[2013.06.03 10:02:02]
UNION 말고 다른 방법이 없을까요?
by 아린
[2013.06.03 10:07:22]
SELECT DISTINCT DECODE(lv, 1, col1, 2, col2) col3
FROM a
, (SELECT LEVEL lv FROM dual CONNECT BY LEVEL <= 2)
by 아발란체
[2013.06.03 10:51:11]
--11g↑
SELECT col3 FROM A
UNPIVOT((col3) FOR fn IN((COL1), (COL2)))
by 야신
[2013.06.05 09:25:34]
아발란체님 distinct 가 추가해야 될것 같아요.
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.