How to check room availabilty in a hotel between two dates?
I have a database of booking where we can book a room and new user want to check the room available between two dates or not?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Hemant SrivastavaRank #581 · 4.2K reputationPosted Jun 4, 2013, 9:32 AM EDT
DECLARE @IS_ROOM_AVAIALABLE BIT;
SET @IS_ROOM_AVAIALABLE = 0;
IF NOT EXISTS
(
SELECT ROOM_NUMBER
FROM ROOM_BOOKING_TABLE
WHERE BOOKING_DATE BETWEEN '2013-05-17 00:00:00.000' AND '2013-05-25 00:00:00.000'
)
BEGIN
@IS_ROOM_AVAIALABLE = 1
END
above query is just an example. Modify the query as per your DB schema
Khargesh RajputRank #616 · 3.9K reputationPosted Jun 8, 2013, 1:34 AM EDT
i got solution using your example