I need to select all free rooms from hotel DB and I think I can do it with two steps:
bookings = select * from booking where booking.startDate>=selectedStartDate and booking.endDate=<selectedEndDate.- pseudo query:
select * from room where room.room_id not includes bookings.room_id.
I wrote my second query like pseudo query because I can't find how I can do what I want to do. How to check that bookings doesn't includes room_id's?
My booking table looks like:
+-----------+------------+------------+---------+---------+
| bookingId | startDate | endDate | room_id | guestId |
+-----------+------------+------------+---------+---------+
| 1 | 2016-03-12 | 2016-03-22 | 1 | 1 |
| 2 | 2016-03-12 | 2016-03-22 | 2 | 2 |
+-----------+------------+------------+---------+---------+