Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Hotel Booking dates subquery

Re: Hotel Booking dates subquery

From: Jan Hidders <hidders_at_REMOVE.THIS.uia.ua.ac.be>
Date: 11 Nov 2002 18:37:49 +0100
Message-ID: <3dcfeaed$1@news.uia.ac.be>


Scotty wrote:
>Scotty wrote:
>>Jan Hidders wrote:
>>>
>>>Btw., you can still
>>>simplify your query a litte: you can remove tha -todate(...) everywhere and
>>>the first and second equations are redundant.
>>
>>Ok, I'll have a play with it and see what optimisation can be
>>performed. I've yet to put in the check for room status so it should
>>hopefully be a decent query when its done.
>
>Here's the end product, hopefully if anyone can see any potential
>problems with this query they'll comment.
>
>SELECT booking_id,room_id,startdate,enddate
>FROM booking
>WHERE
>TO_DATE('17-11-02','dd-mm-yy') - sysdate < startdate - sysdate
>OR
>TO_DATE('20-11-02','dd-mm-yy') - sysdate > enddate - sysdate;

Ahem, :-), you need to swap the 17-11-02 and the 20-11-02, and, yes, I did check if I read the '<' and '>' correctly. :-) Remember that the formula was:

  end1 < begin2 or begin1 > end2

where one period is [begin1, end1] and the other period is [begin2, end2].

Received on Mon Nov 11 2002 - 11:37:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US