This question already has an answer here:
I'm building a booking system for a bike rental company. We have a database where each bike can be reserved between two different dates.
If I search between two dates 2019-08-06 and 2019-08-07 every bike that is reserved between the two dates will come up.
ID / DATE_START / DATE_END
2 / 2019-08-06 / 2019-08-08
3 / 2019-08-06 / 2019-08-08
The problem is that when I search between the date 2019-08-05 and 2019-08-06 it will not come up that the bike is booked 2019-08-06.
I have tried to use between and not in but can't get a result.
SELECT Bike.ID
FROM Bike
WHERE
Bike.DATE_START <= '2019-08-05'
AND
Bike.DATE_END >= '2019-08-06'
I want to find each Mysql record that has a timestamp somewhere between two dates. How can I do that?
</div>