I'm writing a job vacancy database for a bit of fun (and to try and learn T-SQL/SQL Server and this is what I have in my applications table so far.
application_id name interviewer location_id from to
-----------------------------------------------------------------------------------------------------------
1 Joe Bloggs Sarah Saunders 100 2008-12-25 00:00:00 2008-12-26 00:00:00
2 Barry White Issac Hayes 100 2008-12-29 00:00:00 2008-12-30 00:00:00
It's easy enough to find out what bookings have been made for these dates; a simple select statement would find these out easily enough.
The only problem I have now is how to figure out what days DON'T contain bookings. I'd like to do a search on the following table to see what dates are available in the room with location_id 100 between "2008-12-25 00:00:00" and "2008-12-30 00:00:00" and have it return that there is no interview being held in the room from the 27th to the 28th.
I'm sure this is painfully easy, but please lay some SQL wisdom on me.
Similar to this: http://stackoverflow.com/questions/704176/how-to-implement-check-availability-in-hotel-reservation-system/704185