SELECT *
FROM room
WHERE room_no NOT IN
(
SELECT room_no
FROM booking
WHERE check_outdate >= @req_fdate
AND check_indate <= @red_tdate
)
AND room_no NOT IN
(
SELECT room_no
FROM reservation
WHERE check_outdate >= @req_fdate
AND check_indate <= @red_tdate
)
Preste atención al orden o los argumentos:@req_fdate
aquí está la primera fecha aquí (desde ), @req_tdate
es la última fecha (hasta ).
Para comprobar la disponibilidad a partir del Aug 16
al Aug 19
, usa esto:
SELECT *
FROM room
WHERE room_no NOT IN
(
SELECT room_no
FROM booking
WHERE check_outdate >= '2010-08-16'
AND check_indate <= '2010-08-19'
)
AND room_no NOT IN
(
SELECT room_no
FROM reservation
WHERE check_outdate >= '2010-08-16'
AND check_indate <= '2010-08-19'
)