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: Date range grouping

Re: Date range grouping

From: Alan D. Mills <alanmNOSPAM_at_uk.europe.mcd.mot.com>
Date: Mon, 12 Oct 1998 13:21:03 +0100
Message-ID: <6vss69$pio$1@schbbs.mot.com>


I like this one. My true problem is one of date ranges and not specific dates so I don;lt think a can apply it in this case. However, I WILL remember it for future reference .

Thanks.

--
Alan D. Mills

Grinberg L. wrote in message <6vsg4g$kpo_at_grant.grant.UUCP>...
>
>
>Try to combine DECODE and SIGN. For example, next statement selects
>one record four sums.
>
>
>SELECT
> sum(decode(sign(trunc(mydate)-trunc(sysdate)), - 1, MyVal,0)) last_sum,
> sum(decode(sign(trunc(mydate)-trunc(sysdate)), 0, MyVal,0)) today_sum,
> sum(decode(sign(trunc(mydate)-trunc(sysdate+1)), 0,MyVal,0))
tomorrow_sum,
> sum(decode(sign(trunc(mydate)-trunc(sysdate+1)), 1,MyVal,0))
>after_tom_sum,
>FROM MyTable;
>
>
>
Received on Mon Oct 12 1998 - 07:21:03 CDT

Original text of this message

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