|
|
 |
Re: FN-FORUM: mysql!
date posted 30th May 2006 20:55
> table 1 - times
>
> time_id (auto)
> time_set ( the time of day available)
> time_type (0 - weekday , 1 =3D weekend)
>
>
> table 2 =3D bookings
>
> book_id (auto)
> book_date (date stamp)
> time_id (time of booking)
> payment_id (payment stuff_
> c_id (customer id)
>
>
> ok so i want to LIST all the times from the time table!
>
> if the time exists in the booking table for that date i want i want it=
to
> say booked next to the time in the list.
SELECT time_id, book_id
FROM times
LEFT JOIN bookings ON bookings.time_id =3D times.time_id
This will give a result list of time_id and book_id rows. Where the time=
=
is available book_id will be NULL, otherwise it'll be the book_id of the=
=
relevant booking.
You can add more information into the result rows if you like, if they'r=
e =
columns from times they'll always have values, if they're columns from =
bookings they'll have values of NULL if there is no booking for that tim=
e.
Cheers!
Anthony
-- =
www.fonant.com - Quality web sites
|
 |
|