|
|
 |
Re: FN-FORUM: mysql!
date posted 30th May 2006 19:08
On Tuesday 30 May 2006 7:12 pm, [EMAIL REMOVED] wrote:
> did i got it to output booked!! but i was having some problems.. maybe =
i
> could do this in a JOIN with some condinials??
I've got to admit that finding a good clear explanation of JOINs is quite
hard, even if you know what you're looking for. But try this:
http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN=
-and-OUTER-JOIN.html
So it looks like a LEFT JOIN is what you want - every single row of your=20
times table gets returned, and if there is no corresponding booking then
you will get NULLs returned in the booking fields.
It's well worth playing around with the raw SQL statements at the command=
=20
line, or through a phpmyadmin window, to get a feel for how the statement=
s
work (and also get a feel for how much unneccessary crud gets returned=20
from lazy "select *" style programming).
[Here, OTOH is an example of how *not* to try and explain it, from=20
mysqlfreaks.com: "If there is any data in the second table that does=20
not directly relate to the first table, that data will not be returned."]
|
 |
|