Wednesday, 28 August 2013

Mysql select record that should have today and tomorrow date

Mysql select record that should have today and tomorrow date

I want to select record that must have two or more entries but should have
today and tomorrow date in table. I am saving date in table in date
format.
SELECT `availibility`.*
FROM (`availibility`)
WHERE `property_id`= 8818
AND (availibility.unavailibility_date between CURDATE()
AND DATE_ADD(CURDATE(),INTERVAL 1 DAY))
I am using above query but this will true even one date (today or
tomorrow) exists. I want to get such record that should have both dates
for example
ID property_id Date
369516 8818 2013-01-19
369517 8818 2013-01-18
369518 8818 2013-01-17
418021 8818 2013-08-27
418022 8818 2013-08-28
418022 8818 2013-08-29
418022 2001 2013-07-29
418022 2001 2013-07-30
8818 property should come in record set because both date exists here

No comments:

Post a Comment