A B C D E 데이터를 WHERE 로 조회하면
AB
AC
AD
AE
BC
BD
BE
CD
CE
DE
이렇게 10개의 경우의 수가 리턴되게 SELECT 문을 짜고 싶은데
머리가 안돌아가네요 방법이 있을까요?
-- 휴대전화로 작성해서 안 이쁨
WITH ttt AS ( SELECT 'a' ccc FROM dual UNION ALL SELECT 'b' FROM dual UNION ALL SELECT 'c' FROM dual UNION ALL SELECT 'd' FROM dual UNION ALL SELECT 'e' FROM dual ) SELECT * FROM ttt iii INNER JOIN ttt jjj ON iii.ccc < jjj.ccc ;
WITH t AS ( SELECT 'A' v FROM dual UNION ALL SELECT 'B' FROM dual UNION ALL SELECT 'C' FROM dual UNION ALL SELECT 'D' FROM dual UNION ALL SELECT 'E' FROM dual ) SELECT REPLACE(SYS_CONNECT_BY_PATH(v, '-'), '-') x FROM t WHERE LEVEL = 2 CONNECT BY PRIOR v < v AND LEVEL <= 2 ; http://gurubee.net/lecture/2196