Subject Re: nested join sql help
Author Svein Erling
JOIN is an inner JOIN, whereas LEFT JOIN (or RIGHT JOIN or FULL JOIN) is an outer JOIN. Tables joined through inner joins normally go in the WHERE clause, whereas greater care has to be taken with the other three kinds of joins (the right table in LEFT JOINs or left table in RIGHT JOINs and any tables joined to them (? - I'm a bit uncertain about this) ought to be restricted in the JOIN clause as opposed to the WHERE clause. FULL JOINs I think ought to be restricted only through the JOIN clause).

So yes, keep your criteria for the tables simply joined in your WHERE clause.

Set

--- In firebird-support@yahoogroups.com, "Pete Bray" <pete@s...> wrote:
> Set,
>
> i took note of your comments and changed the query so that the
> restriction was performed in the join. As the original query has 2
> other joins in it and a large 'where' clause i was about to migrate
> the other sections of the where clause to the relevent join
> conditions and then realised that you said 'left join'. as the
> other 2 joins are 'join' rather than 'left join' would it be safe
> to leave the restrictions in the 'where' clause?
>
> Kind regards,
> Pete