Groan... the second query below is faster but also incorrect.
Stick to the first query.

(Last email for the night - I swear.  ;-)

> Yet another way:
> 
>  SELECT * FROM books LEFT OUTER JOIN 
>   (users JOIN loans ON name=user_name) ON id = book_id;
> 
> Interestingly, the above query is less efficient than:
> 
>   SELECT * FROM books LEFT OUTER JOIN 
>   (select book_id from users JOIN loans ON name = user_name) 
>   ON id = book_id;
> 
> as the former query does the equivalent of 
> 
>   (select * from users JOIN loans ON name=user_name)
> 
> for the inner subselect.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to