SELECT ID, Name
FROM dbo.AmenitiesList
WHERE TypeID=@Type and Status = 'Available'
AND ID NOT IN
(SELECT AmenitiesID FROM dbo.ReservationList
WHERE Status = 'Cancelled' AND StartDate between @Arrival and @Departure
or EndDate between @Arrival and @Departure
or @Arrival between StartDate and EndDate
or @Departure between StartDate and EndDate)
这是我的查询,我想显示状态为“已取消”且到达日期和离开日期不在数据库中的到达日期和离开日期之间的所有可用设施。但是在检索数据时,我没有得到可用的设施,因为当状态被取消时,它会触发关于日期之间的其他条件。如何避免这种情况?
我想显示已取消且不在 ArrivalDate 和 Departure Date 之间的设施
提前谢谢你们!