Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: 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

  2. #2
    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];

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •