At 17:05 +0200 11/4/06, Barry wrote:
Once you get a hang on JOINs you will love it =)

Yeah - it certainly seems promising. Better do some more reading!

Just remember:

everytime you do something like this: WHERE table1.id = table2.id
You will be safer and faster to use JOINs because that's what ON is for:
LEFT JOIN table2 ON table1.id = table2.id

LEFT join puts the WHOLE table2 to the right of the LEFT JOINED table1.

example:
(Hi, i'm table 1 with all my content) LEFT JOIN (Hi, i'm table 2 with all my content)

if you use Where:
(Hi, i'm table 1 with all my content) WHERE t2.id = t1.id (Hi, i'm table 2 but only giving you the content you wanted to see with your WHERE clause, i keep the rest for myself!!)

Hmmm - now you've confused me a bit. Quoting from the section in the DuBois book:

"...a LEFT JOIN forces the result set to contain a row for every row in the left side table, whether or not there is a match for it in the right side table"

...which isn't necessarily what I want in all cases.

--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

I've had a wonderful evening - but this wasn't it.
   -- Groucho Marx to his hostess on leaving a party

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to