我在查询我的空房时遇到了很大麻烦,我有这个问题
select rooms.*
, ty.*
FROM tbl_room rooms
JOIN tbl_roomtype ty
ON rooms.RoomTypeID = ty.RoomTypeID
WHERE rooms.RoomID NOT IN
(SELECT t1.RoomID
FROM tbl_room t1
JOIN tbl_reservationext t2
ON t1.RoomID = t2.RoomID
JOIN tbl_reservation rr
ON t2.ReservationID = rr.ReservationID
WHERE NOT('$date_to' < rr.CheckIn_datetime
OR ('$date_from' > rr.CheckOut_datetime)
)
)
此查询工作正常,但它不会查询标记为已解除的保留。
我试过把一些AND rr.Status!='Dismissed'但仍然无效。
有人可以帮助我。