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

Home -> Community -> Usenet -> comp.databases.theory -> Re: HELP for group by

Re: HELP for group by

From: Ralf Mrowka <ralf.mrowka_at_charite.de>
Date: Fri, 31 May 2002 10:23:02 +0200
Message-ID: <3CF732E6.CCC4218A@charite.de>


Thank you for the hint!

It works now with the addition of the END in the CASE syntax!

Thanks a lot!!!!!!!!!!!!

Ralf

Nis Jorgensen wrote:
>
> On Fri, 31 May 2002 09:29:29 +0200, Ralf Mrowka
> <ralf.mrowka_at_charite.de> wrote:
>
> >I have the following table
> >
> >member1 member2 value
> >A B 10
> >A C 11
> >A L 9
> >A F 2
> >B K 10
> >B O 11
> >
> >
> >I want to count how often each member1 meets any member2 given that
> >value is
> >larger that XX
> >this works fine with
> >
> >select member1, count(member2) from table where value<XX group by
> >member1 ;
> >
> >The problem is that I also want to see in the result member1 if member1
> >e.g. A
> >meets none (0) member2 when XX is e.g. 40.
>
> select member1, SUM(CASE WHEN value<XX THEN 1 ELSE 0) from table group
> by member1 ;
>
> (not sure about the CASE syntax)
>
> --
> Nis Jorgensen
> Amsterdam
>
> Please include only relevant quotes, and reply below the quoted text. Thanks
Received on Fri May 31 2002 - 03:23:02 CDT

Original text of this message

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