Re: date overlap

From: Eric Givler <egivler_at_flash.net>
Date: Fri, 22 Dec 2000 03:16:35 GMT
Message-ID: <nIz06.16123$bw.1338492_at_news.flash.net>


thanks a lot!

"Mike Krolewski" <mkrolewski_at_rii.com> wrote in message news:91pevi$8ad$1_at_nnrp1.deja.com...
> In article <hJV%5.14235$bw.1170406_at_news.flash.net>,
> "Eric Givler" <egivler_at_flash.net> wrote:
> > What's the quickest/most efficient way to check for an overlapping
 date
> > range in a SQL statement?
> >
> > Table A:
> > blocked areas
> > area_eid number
> > start_date date
> > end_date date
> >
> > Table B:
> > Reservation
> > Area_eid number
> > arrival_date date
> > departure_date date
> >
> > I don't want to allow reservations that have a "block" record in
 table A
> > with an "overlap" of the date range. There are 7 different
 possibilities
> > for the dates to fall into, 2 of which wouldn't be overlapping the
 block
> > (the ones where both the start and ends appear before or after the
 block).
> > How do I detect the rest EASILY?
> >
> > Thanks!
> >
> >
>
> there are two ways
>
> arrival_date between start_date and end_date
> OR
> departure_date between start_date and end_date
>
>
> Another:
>
> arrival_date <= end_date and
> departure_date >= start_date
>
>
>
> --
> Michael Krolewski
> Rosetta Inpharmatics
> mkrolewski_at_rii.com
> Usual disclaimers
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Fri Dec 22 2000 - 04:16:35 CET

Original text of this message