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: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Fri, 5 Sep 2003 11:31:34 -0700
Message-ID: <xM46b.24$pP2.93@news.oracle.com>

"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:

count(case when this = 'confusing' then 1else null end)

is

sum(case when this = 'confusing' then 1 else 0 end) Received on Fri Sep 05 2003 - 13:31:34 CDT

Original text of this message

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