Reputation: 11
I have a table called "bookings" with rooms id & booking date
as
ID Date
1 2018-04-20
1 2018-04-21
2 2018-04-20
4 2018-04-01
4 2018-04-02
4 2018-04-09
In html the user input the check in date and checkout date
what i want to do is find all rooms id's that has no dates equal or in between the check in and check out input dates...
for example if user input check in as: 2018-04-19 and checkout: 2018-04-21 then result should be : 4
how can i do this ?
Upvotes: 0
Views: 30
Reputation: 6055
You could use NOT BETWEEN
:
SELECT * FROM `bookings` WHERE `date` NOT BETWEEN ? AND ?
Upvotes: 1