ANSI를 오라클 쿼리로 변환 알려주세요
select *
from (select 'a' as col1, '1' as col2 from dual union all
select 'a' as col1, '2' as col2 from dual
) t11
left outer join (select 'a' as col1, '011' as col3 from dual) t12
on t11.col1 = t12.col1
and t11.col2 = '1'
;
결과값
a|1|a|011
a|2|null|null
-> 다시말해 본테이블 데이터는 모두 나오지만 조인시 본테이블의 조건을 주어 조인하고 싶습니다.
오라클 쿼리로 변경을 어떻게 해야 동일한 값을 얻을 수 있을까요?
많은 가르침 부탁드립니다.
WITH t11 AS
(
SELECT 'a' col1, '1' col2 FROM dual
UNION ALL SELECT 'a', '2' FROM dual
)
, t12 AS
(
SELECT 'a' col1, '011' col3 FROM dual
)
SELECT *
FROM t11
, t12
WHERE DECODE(t11.col2, '1', t11.col1) = t12.col1(+)
;