Hi again,

MySQL ver 4.0.25

I'm still playing with a rental calendar that I was originally using just to display booked dates etc, then I had the notion that I could use the same calendar to display prices etc. and also add a search to.

I've looked at a few solutions on this forum, but they only enter booked dates into the table and not those that are available.

My table is basically this:
tbl_availability
----------------------------------------------
id(int11) | status(int1) | ddate(date) | price(int4)
----------------------------------------------
45 | 1 | 2006-02-01 | 250
45 | 1 | 2006-02-02 | 250
45 | 1 | 2006-02-03 | 250
45 | 1 | 2006-02-04 | 300
45 | 5 | 2006-02-05 | 300
45 | 3 | 2006-02-06 | 300
45 | 3 | 2006-02-07 | 300
45 | 5 | 2006-02-08 | 300

I enter a status code of 3 for booked with a code of 5 for changeover days(a quick fix due to not being able to do subqueries on MySQL ver), status code 1 is available.

The search uses an $arrival_date and $dep_date and I am stuck on part of the query.

In long hand I want to be able to select property_id from tbl_availability where ALL ddates between $arrival_date and $dep_date have a value of 1 or 5. Thereby removing any property that has a 3 within those dates from the results. Can this be done without a subquery and if so what logic should I apply?