Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SQL query

Status
Not open for further replies.

staffsalex

IS-IT--Management
Apr 4, 2007
1
GB
Hi, Im currently building a vehicle rental website.
Im workin on a query which is trying to select potential vehicles for reservation but only if it satisfies some certain characteristics:
1) it must be held at the branch (ive been using BranchID = 1 for test purposes)
2) it must be of a certain make and model (ive been using MakeModelID = 3 for test purposes)
3) the query must EXCLUDE those vehicles currently reserved. For this I've been using NOT BETWEEN Collect_Date AND Return_Date.

Table Vehicle

VehicleID Registration MakeModelID BranchID
1 AE02 FWC 3 1
2 DY53 WAJ 3 1

Table Reservation

ReserID CustID VehicleID Collect_Date Return_Date
1 1 1 2007-04-04 2007-04-11

I need a query that will show both AE02 FWC and DY53 WAJ if the user selects:
* 3 for the MakeModelID
* 1 for the BranchID
* 2007-04-12 for the collect date

And only show DY53 WAJ if the collect date was for example 2007-04-09.

Any help would be much appreciated. Thanks. Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top