develog

outer join test 본문

DB/Oracle

outer join test

냐옴 2012. 7. 25. 13:36

SELECT X.USER_SEQ, Y.SCORE1, Z.SCORE2

FROM

(

    SELECT 'A' USER_SEQ FROM DUAL UNION ALL

    SELECT 'B' USER_SEQ FROM DUAL UNION ALL

    SELECT 'C' USER_SEQ FROM DUAL UNION ALL

    SELECT 'D' USER_SEQ FROM DUAL UNION ALL

    SELECT 'E' USER_SEQ FROM DUAL

) X

, (

    SELECT 'A' USER_SEQ, '10' SCORE1 FROM DUAL UNION ALL

    SELECT 'B' USER_SEQ, '20' SCORE1 FROM DUAL UNION ALL

    SELECT 'E' USER_SEQ, '30' SCORE1 FROM DUAL

) Y

, (

    SELECT 'B' USER_SEQ, '100' SCORE2 FROM DUAL UNION ALL

    SELECT 'C' USER_SEQ, '220' SCORE2 FROM DUAL

) Z

WHERE 1=1

AND X.USER_SEQ = Y.USER_SEQ(+)

AND X.USER_SEQ = Z.USER_SEQ(+)

ORDER BY X.USER_SEQ

;





'DB > Oracle' 카테고리의 다른 글

split  (0) 2012.12.11
oracle outer join or  (0) 2012.12.06
DROP, DELETE, TRUNCATE 차이점  (0) 2012.04.10
Comment  (0) 2012.04.10
테이블 이름 변경  (0) 2012.04.10
Comments