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

Home -> Community -> Usenet -> c.d.o.server -> Re: Decode

Re: Decode

From: Scott Mattes <ScottMattes_at_yahoo.com>
Date: Wed, 03 Apr 2002 01:02:44 GMT
Message-ID: <Uwsq8.10714$SG2.1802224@news1.news.adelphia.net>


Maybe its the lingering effects of the weekend's cold, but why don't you

select count(*)
  from cts
where ( ROUND ( ( trunc( SYSDATE ) - TRUNC ( my_date ) ) / 7 + .5, 0 ) ) > 13;

??

"markag" <member_at_dbforums.com> wrote in message news:3caa2e06$1_at_usenetgateway.com...
> Oracle 8.1.5, Windows
>
> I need a decode SQL statement that will look at the difference between
> two dates and determine if they are GREATER THAN 13 weeks. If so, I
> count that row of data. I can do this with an equality test for each
> other week but cannot get it to work with greater Thans. i.e, this will
> count the records in the 'Week 13' bucket;
>
> SELECT DECODE (ROUND ( (SYSDATE - TRUNC (my_date)) / 7 + .5, 0),
> 13,COUNT (record_id), 0) w13 FROM cts GROUP BY TRUNC (my_date)
>
> ..
>
> I do saomething similar to this for each week bucket. I need a final
> bucket that is all inclusive of those > 13 weeks old.
>
> Don't really want to use variables to count the other buckets and
> subtract from a total count....
>
> TIA.
>
>
>
> --
> Posted via dBforums
> http://dbforums.com
Received on Tue Apr 02 2002 - 19:02:44 CST

Original text of this message

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