Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Reservation System

Author  Topic 

chikoshumba
Starting Member

6 Posts

Posted - 2007-08-27 : 15:04:27




I am trying to come up with a query for a reservation system for a small hotel. I have come up with 5 tables, of which only two will be used when searching for a vacant room. The first table is a roomTable and this contains info regarding the rooms at the hotel. eg room# floor, serviceStatus. The primary key in this table is room#.

The second table involved is a Session table. This table has a session number as primary key, and also has room# as foreign key. This table also contains a sessionType, startDate of a session and an endDate. Every time a room booking is made or a user is checked into the hotel a session is recorded into the sessions table.

When searching for room, the user supplies the date when the session should start and the date when this session should then end. I need a query that will enable me to pick all those rooms that are in the roomTable but do not have sessions running during / between the startDate and endDate specified by the user.

If anybody could be of assistance I would be most greatful

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2007-08-27 : 16:03:46
we will need the DDL for all tables mentioned to come up with the proper query. Some sample data for each table would be welcome as well.



-ec
Go to Top of Page
   

- Advertisement -