If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Simple parameter/between problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-25-03, 22:27
locsta locsta is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
Simple parameter/between problem

PARAMETERS spDateBooked DateTime, spDeparture DateTime;
SELECT *
FROM [MV Customers] INNER JOIN Bookings ON [MV Customers].[Cust ID]=[Bookings].[Cust ID]
WHERE [Bookings].[Date Booked]Between [Bookings].[Departure]
AND spDateBooked=[Bookings].[Date Booked] AND spDeparture=[Bookings].[Departure];

I am stuck trying to find our how to display some bookings between one date and another with parameters .... if I put the <= or >= it only takes those exact date ranges yet I can not get the between option to work ... can anyone suggest where I am going wrong? I do not know how to introduce between or if it is the correct way to approch this problem
Reply With Quote
  #2 (permalink)  
Old 11-26-03, 02:04
cvandemaele cvandemaele is offline
Registered User
 
Join Date: Oct 2003
Location: Switzerland
Posts: 140
The between clause requires an upper AND a lower bound. In your select, there is only a lowerbouNd (Bookings.Departure)

Try

SELECT *
FROM [MV Customers] INNER JOIN Bookings ON [MV Customers].[Cust ID]=[Bookings].[Cust ID]
WHERE [Bookings].[Date Booked]Between [Bookings].[Departure]

AND [SomeTable.SomeDateColumn] <= this


AND spDateBooked=[Bookings].[Date Booked] AND spDeparture=[Bookings].[Departure];
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On