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: SQL: Multiple counting

Re: SQL: Multiple counting

From: Maxim Demenko <mdemenko_at_arcor.de>
Date: Fri, 29 Jul 2005 18:01:48 +0200
Message-ID: <42ea53fc$0$11745$9b4e6d93@newsread4.arcor-online.net>


Marco Shaw schrieb:

>>>But I have not been able to figure out how to extend that to keep totals

>
> of
>
>>>the other columns when they match '1'.
>>>
>>>Marco
>>>
>>>
>>
>>You can use that fact, that the count of values containing 1 in a
>>dataset containing only 1 and 0 is equal to sum of that values.

>
>
> OK, that might work. I'd like to know if there's a better way to do it. In
> my example, I may be able to do a sum, but that may not be the case if I
> need to extend my report to other columns.
>
> Marco
>
>

The principle should work, independently what are the values in other columns. You can be assisted with functions like DECODE or CASE, where you can implement nearby every WHEN ... THEN logic and generate 1 resp. 0 for desired resp. undesired values, which can inturn be summarized...

Best regards

Maxim Received on Fri Jul 29 2005 - 11:01:48 CDT

Original text of this message

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