Re: Hotel Booking dates subquery
From: Scotty <invallid_at_invalid.spam>
Date: Mon, 11 Nov 2002 17:04:09 +0000
Message-ID: <1jovsuchv3ecsei9l887gjtofafsgdtk6q_at_4ax.com>
Date: Mon, 11 Nov 2002 17:04:09 +0000
Message-ID: <1jovsuchv3ecsei9l887gjtofafsgdtk6q_at_4ax.com>
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;
Received on Mon Nov 11 2002 - 18:04:09 CET
