I have a table:
rommbookinfo
(
hotel_id
, room_no
, start_date
, end_date
);
Now I have to perform a query to find rooms for the given hotel (hotel id) that are not booked in the date range( ie in between date1 and date2)
SELECT *
FROM tbl_roombook
WHERE hotel_id = '2'
AND start_date NOT BETWEEN 12/17/2011 AND 12/19/2011
OR end_date NOT BETWEEN 12/17/2011 AND 12/19/2011
but it throws the following error:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
''SELECT * FROM tbl_roombook WHERE hotel_id='2' AND start_date' at line 1
try