I am trying to select between 2 different dates in 2 different columns and I thought I understood how to until I reached this issue. I think I am better providing an example:
A room has an IN date and an OUT date (hotel issues related). I want to select rooms NOT between inDate and outDate. Therefore I could use this query:
select * from room where inDate and outDate not between '2019-06-19' and '2019-06-26';
Let us imagine that we have a room with inDate = '2019-06-18'
and outDate = '2019-06-21'
.
My question is, which could be the right query to know that an user can not book that room because at that time the room is unavailable? Because if we use the previously mentioned query, that room will be available, and it is obviously not.
I have seen many pages on this page asking similar things, but I have tried not to create a duplicate. Sorry in advance if this is a duplicate and I hope I explained myself correctly.