Best unofficial Apache Server developers community |
|
How do you find availability across multiple hotels, room types, blackout dates, and reservations? A solution using MySQL (and PHP if necessary) is desired. Input: #rooms required, #people per room, check in date, number of nights. Example: 2 rooms, 3 people per room, 4/14/2011, 3 nights Output: will show hotel and room details if there is availability across the date range. Sample tables:
Notes: "Capacity" is the number of people that can fit in a room. Blackout_T are the dates and quantity of rooms not available by hotel and room type. So for the first example of input "2 rooms, 3 people per room, 4/14/2011, 3 nights" no result is produced because both the Reservation_T and Blackout_T make only 1 room available during that date range. However, with input of "1 room, 3 people per room, 4/14/2011, 3 nights" would return Hotel_1, King. I've come up with an ugly solution involving php looping over multiple queries, but I'm guessing there is a much more efficient way. Thanks for your ideas in advance!
posted via StackOverflow
|
|
 
|
You could take your PHP function and make it a stored procedure, which would make it run much faster, but you're not going to get what you want as a single SQL query. |