This code works great to find an available room for a specific date, but it doesn’t work to show the number that has been booked and canceled.
"Hotel" has 4 rooms and 1 of them is booked canceled
So, even if I do the undo, the select method continues to give me 3 results. Maybe because the second one And it still works. So basically I need
- check if the room is booked on selected dates.
- if it has been booked, check if it is canceled
- if it was canceled or not registered, display it. Otherwise not
SELECT RoomNo, NightCost
FROM room, room_types, booking
WHERE typeid = fk1_typeid
and double_bed=1
and single_bed=0
AND canceled = '1' in
(SELECT canceled
from booking, room_booking
where bookingid = fk2_bookingid)
AND RoomNo not in
(SELECT fk1_RoomNo
FROM room_booking
WHERE '2010-04-02' between Check_in
and Check_Out or
'2010-04-03' between Check_in
and Check_Out) ;
I tried to be as clear as possible, I will be there to provide more detailed information if necessary
Audel