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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-13 : 08:06:53
Bill writes "I have this database that has 2 tables.
VehicleInfo
VehicleStat

Table VehicleInfo has all the info on the Vehicle.

When someone wants to reserve a vehicle they look up by date and if they pick a date then I timestamp each day they have that vehicle reserved. Well my problem is if I want to look at say what vehicle is not checked on say July 1st then I dispaly all the vehicles that available on July 1st. Well if a vehicle is checked out on the 1st and it is checked out on other day it still shows the vehicle as available for the first.

What would be the way to solve this problem.

Bill"

Nazim
A custom title

1408 Posts

Posted - 2002-06-13 : 08:39:36
Bill, you should store in table vehiclestat all the reservations made on a particular vehicle with datetime instead of storing only a single record and updating the last reservation.

eg data for Vehicle info
vehicleno reservedtime
----------------------------
101 1-Jul-2002
101 10-jul-2002
102 5-Aug-2002

you can easily write a query to retrieve the vehicles which are not on a particular date by inner joining both the table and filtering the records on that datetime.

HTH


-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson
Go to Top of Page
   

- Advertisement -