On 4/13/05, Gints Plivna <gints.plivna@xxxxxxxxx> 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 -- //www.freelists.org/webpage/oracle-l