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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Lag function problem was: Never ending activity in temp file

Re: Lag function problem was: Never ending activity in temp file

From: Edgar Chupit <chupit_at_gmail.com>
Date: Wed, 13 Apr 2005 15:28:31 +0300
Message-ID: <a8f0771c05041305285b8f4bf0@mail.gmail.com>


On 4/13/05, Gints Plivna <gints.plivna_at_gmail.com> wrote:
> The real problem generally was, to count all codes for particular persons=
,
> but in a following manner:
> if person has code 'LVA' then count it and only it.
> if person hasn't code 'LVA' then count all other codes particular person =
has.

For a question like this you probably don't need analytics at all. You can write it using simple group by functions:

    SELECT id

               , nvl( sum( case when code =3D 'LVA' then 1 end ), count(*) ) code_count

       FROM source
    GROUP BY id

Have a nice day.

--=20
  Edgar

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 13 2005 - 08:32:33 CDT

Original text of this message

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