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: Multiple selects

Re: Multiple selects

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 6 Sep 2003 16:14:42 GMT
Message-ID: <bjd15i$hticm$1@ID-82536.news.uni-berlin.de>

>
> "Rene Nyffenegger" <rene.nyffenegger_at_gmx.ch> wrote in message
> news:bjaek1$gb9tu$1_at_ID-82536.news.uni-berlin.de...

>> select
>>   count(
>>     case when
>>       this = 'that' and
>>       that = 'the other'
>>     then 1
>>     else null end) "Count 1",
>>   count(
>>     case when
>>       this = 'this' and
>>       that = 'that'
>>     then 1
>>     else null end) "Count 2",
>>   count(
>>     case when
>>       this = 'confusing'
>>     then 1
>>     else null end) "Count 3"
>> from
>>   myTable;

>
> NULLs in the solution are always better be avoided:

It doesn't make any difference.  

> count(case when this = 'confusing' then 1else null end)
>
> is
>
> sum(case when this = 'confusing' then 1 else 0 end)

Everybody has his preferences.

Rene  

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch
Received on Sat Sep 06 2003 - 11:14:42 CDT

Original text of this message

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