MySQL Forums
Forum List  »  InnoDB

Listing dates that don't exist, schedule listing.
Posted by: Stuart Corbishley
Date: September 14, 2008 05:21AM

I want to generate a table of available timeslots for a booking system, the timeslots are set in a table, and the current bookings are in a bookings table.

I basically would like an output like this

|--------|----------------|-------------|
| Date | Timeslot | Booking_ID |
|--------|----------------|-------------|
| 16/4/08| 8:30 | null |
| 16/4/08| 12:30 | null |
| 16/4/08| 15:30 | 56 |
| 17/4/08| 8:30 | null |
| 17/4/08| 12:30 | null |
| 17/4/08| 15:30 | 45 |
|--------|----------------|-------------|

So if the date doesn't match up it still puts it out...
My intent is to generate a schedule for a whole week, by specifying the start date... it would fetch the timeslots available, and then generate a list of timeslots for each day in that week, and only if there is a booking matching that combination, then return the booking_id that relates.

I've been playing with IN statements and BETWEEN, and a few others, it's really confusing me, especially generating a list of dates that don't specifically exist.

Any help would be REALLY appreciated!

Options: ReplyQuote


Subject
Views
Written By
Posted
Listing dates that don't exist, schedule listing.
2647
September 14, 2008 05:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.