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?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Khargesh RajputPosted Jun 8, 2013, 5:34 AM
i got solution using your example
Hemant SrivastavaPosted Jun 4, 2013, 1:32 PM
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