August 26, 2012 at 9:51 am
[font="Times New Roman"][/font]
I'm a university student and I'm developing a database for a hotel system ,now I'm stack when I try to check rooms that are available for a specific date,room_status and type of a room.I'm using SQL server 2008, I have two table that m checking on which are : dbo.RoomBooking(Booking_ID,Room_Number,Arrival_date,Departure_date) , dbo.Rooms(Room_Number,Room_type,Room_status)
I hv tried this query: create proc GetAvailableRoom
(@RT_Name char(15), @ArriveDate Date, @DepDate Date)
AS SELECT Room_no from Rooms r ,Room_Type rt
WHERE r.Room_Type_Code = rt.Room_Type_Code and
Room_no NOT IN (Select Room_no FROM Room_Bookings
Where Chck_in_Date Between @ArriveDate and @DepDate and
Chck_out_Date between @ArriveDate and @DepDate)
and rt.Room_Type_Name = @RT_Name and Room_Status = 'Avail'
go
August 26, 2012 at 10:45 am
This cannot be the correct forum for this. ...
Please repost in either the SQL 2008 forum or in the SQL Newbies forum.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
August 26, 2012 at 11:15 am
Mr Jones told me to post here,so I dnt knw wat you mean now. give me the link of that forum.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply