| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Help with a query please
Originally posted by John
> How can i check whether a user is already booked for a given period? I
> have tried the following query but this only checks for a booking that
> starts before the gaiven date and ends after it
>
> SELECT B.*
> FROM WMS_User U, WMS_Bookings B
> WHERE B.User_ID = '1'
> AND B.Booking_Start_Date >= '2003-04-28'
> AND B.Booking_End_Date <= '2003-04-29'
>
> if a user is booked from 2003-04-29 to 2003-05-01 then the query
> returns no
> rows...
>
If you want any bookings that overlap the date range at all, do this:
AND B.Booking_End_Date >= '2003-04-28'
AND B.Booking_Start_Date <= '2003-04-29'
-- Posted via http://dbforums.comReceived on Wed Apr 23 2003 - 04:21:09 CDT
![]() |
![]() |