Pages

04/07/2012

[SQL] Left and Right Join inside WHERE condition

In Oracle SQL you can perform a LEFT(or RIGHT) JOIN inside the FROM statement (SQL ANSI-89 standard) with:

SELECT *
FROM table1 RIGHT JOIN table2 ON table1.id1=table2.id2

or inside the WHERE condition as:

SELECT *
FROM table1, table2
WHERE table1.id(+)=table2.id



The LEFT JOIN is achieved with = table2.id(+) instead

No comments:

Post a Comment

With great power comes great responsibility