Hi All,
I'm totally stumped on this problem, I hope you can help.
I'm working on a vacation property rentals database and one of the forms allows the user to search for all properties that are available between x and y dates.
The bookings table stores the bookings for each property, with a start date and an end date.
I have two tables (I've reduced the number of fields to make this example easier):
property
*prop_id
name
Bookings
*booking_id
prop_id
date_from
date_to
user_id
I'm more used to SQLServer so my first attempt used the IN() function, something like...
SELECT prop_id, name from property WHERE prop_id NOT IN(SELECT prop_id FROM bookings WHERE (x BETWEEN date_to AND date_from) OR (y BETWEEN date_to AND date_from)
But my version of MySQL doesn't support the IN statement, There must be a way around it. If I have to restructure the data I will.
Please help, it's frying my brain!