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)
This is my query, I want to display all the Available Amenities that the status is 'Cancelled' and the Arrival Date and Departure date is not between in the ArrivalDate and Departure date in Database. But when retrieving data, I didn't get the Amenities available because when the Status is cancelled it triggers the other condition about those in between dates. How to Avoid that?
I want to display Amenities that is Cancelled and also not between ArrivalDate and Departure Date
Thank you in advance guys!
(@Arrival <= EndDate) AND (@Departure >= StartDate)