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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Math equation needed to solve SQL problem

Re: Math equation needed to solve SQL problem

From: Paul Q <paulq_at_home.com>
Date: Fri, 05 Nov 1999 02:32:54 GMT
Message-ID: <qlrU3.23439$it.588749@news2.rdc1.on.home.com>


Substitute your fields and table names and date_range

SELECT WHEN
FROM DATES
WHERE
TRUNC(MOD(MONTHS_BETWEEN(WHEN,TO_DATE('01-JAN-1998','DD-MON-YYYY')),36)) =0 OR MOD(MONTHS_BETWEEN(WHEN,TO_DATE('01-JAN-1998','DD-MON-YYYY')),36) <= MONTHS_BETWEEN(TO_DATE('01-JUN-1998','DD-MON-YYYY'),TO_DATE('01-JAN-1998','D D-MON-YYYY')) mrs_gleeson_at_my-deja.com wrote in message <7vsd2b$vrn$1_at_nnrp1.deja.com>...
>Hi,
>I have a user entered date range (from, to).
>Lets say (08/01/1999- 08/31/1999)
>In the table I have record w/ unkown differnet dates. I need to pick
>the dates from the table that if I keep adding 3 years to them, they
>end up in the above date range.
>
>Example:
>the table_date (08/10/1993) if I keep adding 3 years to it, it will end
>in the range
>(08/10/1993 + 3 yrs = 08/10/1996). Add another 3 yrs
>(08/10/1996 + 3 yrs = 08/10/1996). Add another 3 yrs = (08/10/1996 + 3
>yrs = 08/10/1999) which is in the range (08/01/1999- 08/31/1999).
>
>2ND Example:
>the table_date (02/01/1994 + 3 yrs = 02/01/1997). Add another 3 yrs
>(02/01/1997 + 3 yrs = 02/01/2000) which is not in the range
>(08/01/1999- 08/31/1999).
>
>Please help! I need a math wizard to give me ONE select statement that
>contains a mathematical equation. Maybe there is a way in Oracle's
>function that can tell me if the table_date is between the date range
>or not????
>Thanks in advance.
>--MS.Gleeson
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Thu Nov 04 1999 - 20:32:54 CST

Original text of this message

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