On Thu, Dec 27, 2001 at 01:21:08PM -0700, Ken Kinder wrote:
> I guess I'm just old fashion. I learned with the terms inner and outer joins, 
> and I conceptually in struggling with this left/right join stuff -- I thought 
> the order it joins the tables was simply a matter of optimizer logic.

That's true for inner joins. The tables in an outer join are treated 
differently, so order matters. One and only one table in an outer join 
is preserved, and you have to specify which table is preserved. When 
a table is preserved, all rows are returned, even the rows that don't 
have a match in the other table. (The WHERE clause may prevent some 
rows in the preserved table from being returned.)
 
> Can someone give me a rule of thumb in understanding what this left/right 
> join business is vs inner/outer joins?

In a left outer join, the table to the left of the LEFT JOIN keywords 
is preserved. In a right outer join, the table to the right of the 
RIGHT JOIN keywords is preserved. So 
    a LEFT JOIN b
is the same as 
    b RIGHT JOIN a
Table a is preserved in both cases.

Bob Hall

---------------------------------------------------------------------
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