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: How to SELECT the COUNT??

Re: How to SELECT the COUNT??

From: Philippe <parnaud_at_yahoo.com>
Date: Tue, 27 Apr 1999 10:20:57 +0200
Message-ID: <7g3s3m$8h2$1@concorde.ctp.com>


Hi violin,

SELECT COUNT(DECODE(SAL_TYPE,'A',1,null)) TYPE_A, COUNT(DECODE(SAL_TYPE,'B',1,null)) TYPE_B FROM EMP; HTH,
Philippe

Violin wrote in message <3725d18a.8528533_at_news.twsc.pouchen.com.tw>...
>Hello all,
>I have a select count question.
>If I have a table like this:
>
>EMPNO SAL_TYPE
>--------------------------------
>00001 A
>00002 A
>00003 B
>00004 A
>00005 B
>00006 B
>00007 A
>
>I want to do a select :
>SELECT COUNT(T1.EMPNO) "TYPE_A",
> COUNT(T2.EMPNO) "TYPE_B"
>FROM EMP T1,EMP T2
>WHERE T1.SAL_TYPE = 'A' and
> T2.SAL_TYPE = 'B';
>
>The result like this:
>TYPE_A TYPE_B
>---------------------------------
> 4 3
>
>How to do the SELECT COUNT sql?
>Thanks for your tips.
>
>Violin.
>violin.hsiao_at_mail.pouchen.com.tw
Received on Tue Apr 27 1999 - 03:20:57 CDT

Original text of this message

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