Notes about the ON condition
You often use the ON clause with join conditions,
but the ON clause allows non-join predicates also.
To ensure that you receive the results you want, keep in mind the
order of evaluation of predicates.
- Place all join conditions within the ON clause.
- Place all search condition predicates for the inner table within
the ON clause. The inner table is the right table
in a left outer join. For example:
SELECT * FROM cows_one LEFT OUTER JOIN cows_two ON (cows_one.cnumber = cows_two.cnumber AND cows_two.cnumber < 3); - Place all search condition predicates for the OUTER table within
the WHERE clause. An outer table is the left table in a left outer
join. For example:
SELECT * FROM cows_one LEFT OUTER JOIN cows_two ON (cows_one.cnumber = cows_two.cnumber) WHERE cows_two.cnumber < 3;