On 3 Jun 2002, at 22:23, Benjamin Pflugmann wrote:

> You missed to mention that using LEFT JOIN changes the meaning of the
> SELECT in question and it may also be a lot slower, dependend on the
> data.
> 
> I think STRAIGHT_JOIN is more appropriate to force the tables to be
> read in a certain order.

You're right in general, and I should have qualified my answer more.  
I think LEFT JOIN is a good choice in cases like this where there is 
one main table and several associated tables that have exactly one 
matching record each.  Using STRAIGHT_JOIN in that case would produce 
the same results if all your data is correct, but if you somehow had 
records missing from your associated tables, then you'd end up with 
missing records in your results, which might be less noticeable than 
the partial records returned with LEFT JOIN.  That may or may not be 
worth worrying about.

I don't think LEFT JOIN is slower than STRAIGHT_JOIN in that (common) 
circumstance, but I could be wrong.

Using LEFT JOIN when possible also has the minor advantage that it's 
standard SQL rather than MySQL-specific.  But then there's probably 
going to be plenty of other MySQL-specific SQL in your queries 
anyway.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to