Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL: Multiple counting
Marco Shaw schrieb:
>>>But I have not been able to figure out how to extend that to keep totals
>>>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.
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