I have two MySQL (MyIsAm) tables that represent letting units and bookings:
- LettingUnits (
ID,Name, etc...) - LettingUnitBookings (
ID,F_LU_ID,Start,End)
Where F_LU_ID is a foreign key to the unit.
What is the best way to search for units that are available during a certain time frame? The search is passed a Start, End and Duration.
- Start = Earliest start of the booking
- End = Latest end of the booking
- Duration = Duration of the booking
I'd be interested to know if it's even possible to do this in MySQL, however if not then the best way to do it in PHP.


Answers