Steve Ruby wrote:
>
> Christian Hammers wrote:
> >
> > Hello list
> >
> > While browsing old sources by a former employee I realised that he always
> > did comma seperated joins and then a "where"
> > FROM
> > tablea a, tableb b, tablec c
> > WHERE
> > a.id=b.id and b.nr=c.nr
> > whereas I learned to do
> > FROM
> > tablea a
> > LEFT JOIN table b USING (id)
> > LEFT JOIN table c USING (nr)
> >
> > Is one of the two ways preferred about the other? I like my way as it is
> > easier to read and understand but would use anything to gain some speed
> > in my 5+ hour selects...
> >
> > bye,
> >
> > -christian-
> >
>
> He is doing an inner join, you are doing a left join, they (potentialy)
> do not produce the same results.
>
> If you have 5 hour selects you are probably missing some vital indexes, or
> you are using a long of like '%blah' or "OR"
Depending on the data in 'a' and 'b' and the exact WHERE clause
it is possible in many cases that the inner join (commas) will be faster
than the left join.
If 'b' has fewer id values than 'a' for example the database has fewer
rows to search with the inner join.
---------------------------------------------------------------------
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