I have two tables, and this is the name of the table "rooms"
and the other is "orders"
Now I joined the two tables, I need the values when I search between book_form = "2016-12-30"and book_to = "2016-12-31", it will be return true, because these two dates do not exist in the "orders" table, and when searching between book_form = "2016-12-30"and book_to = "2017-01-05"or book_form = "2017-01-03"and book_to = "2017-01-15"it will return false, because that this date exists in the order table.
This is my request.
select * from rooms join room_book on rooms.room_id = room_book.room_id where status = 'available' and room_book.book_from NOT BETWEEN '2016-12-30' AND room_book.book_to NOT BETWEEN '2016-12-31'
NOTE: Unfortunately, the column date is book_from 2017-01-01in the order table.
source
share