Re: [GENERAL] Getting the amount of overlap when using OVERLAPS

2005-09-23 Thread Tony Wasson
On 23 Sep 2005 11:30:24 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I don't think your algorithm for calculating the number of days in the > overlap will work. Picture a scenario where we have one date range that > covers 100 days, and another that covers 10 days, and they overlap by 2 >

Re: [GENERAL] Getting the amount of overlap when using OVERLAPS

2005-09-23 Thread gregstumph
I don't think your algorithm for calculating the number of days in the overlap will work. Picture a scenario where we have one date range that covers 100 days, and another that covers 10 days, and they overlap by 2 days. Doing "age() - age()" will return 90 days, not 2 days. -

Re: [GENERAL] Getting the amount of overlap when using OVERLAPS

2005-09-22 Thread vishal saberwal
create or replace function test1() returns text as $$  DECLARE     mm varchar;     ma bool; BEGIN     SELECT into ma (DATE '2001-02-16', DATE '2001-12-21') OVERLAPS (DATE '2001-10-30', DATE '2002-10-30');     if (ma) then         select into mm  (age(DATE '2001-02-16', DATE '2001-12-21')-age(DATE

[GENERAL] Getting the amount of overlap when using OVERLAPS

2005-09-22 Thread Tony Wasson
Given 2 date ranges, the overlaps functions returns TRUE or FALSE. I want to find the # of days that are overlapping. Is there a "built in" way to do this? Should I just write a function to do it? For instance, this example overlaps, but I want to know how much does it overlap? SELECT (DATE '200