I would be so grateful for some help as I have been stuck on this problem for a while.
I have two tables:
"properties" with columns - property_id, property_name
"availability" with columns - avl_id, property_id, date
eg..
property: 1,house 1 and avl: 1,1,2008-12-20
The availability table holds a row for each day a property is booked. Therefore it can have numerous rows for the same property id.
I am trying to list all properties from the property table which are available ie.. do not have entries/rows between date A and date B.
I have tried numerous SQL queries including:
select p.property_id from property p WHERE EXISTS (SELECT * from availability a where a.date BETWEEN '2008-03-19' AND '2008-03-20') ";
However, I cannot get this to work!
Many thanks in advance!
I have two tables:
"properties" with columns - property_id, property_name
"availability" with columns - avl_id, property_id, date
eg..
property: 1,house 1 and avl: 1,1,2008-12-20
The availability table holds a row for each day a property is booked. Therefore it can have numerous rows for the same property id.
I am trying to list all properties from the property table which are available ie.. do not have entries/rows between date A and date B.
I have tried numerous SQL queries including:
select p.property_id from property p WHERE EXISTS (SELECT * from availability a where a.date BETWEEN '2008-03-19' AND '2008-03-20') ";
However, I cannot get this to work!
Many thanks in advance!