I have a complex non ansi query and I need to convert in ansi query.
so I will take a small example to describe my problem
input query
SELECT a.name,
a.empno,
b.loc,
c.inr
FROM a,
b,
c
WHERE a.deptno = b.deptno(+)
AND b.empno(+) = 190
a.deptno = c.deptno(+)
AND c.empno(+) = 190;
Thanks in advance
Your query is equivalent to the below ANSI compliant query:
SELECT a.name,
a.empno,
b.loc,
c.inr
FROM tab a
LEFT JOIN tab b ON a.deptno = b.deptno AND b.empno = 190
LEFT JOIN tab c ON a.deptno = c.deptno AND c.empno = 190;
You have to place predicates b.empno = 190
and c.empno = 190
inside the ON
clauses of the LEFT JOIN
operations, otherwise LEFT JOIN
becomes an INNER JOIN
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With