Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Grouping NULL values

Re: Grouping NULL values

From: Pratap Singh <singhp_at_BACTC.COM>
Date: Tue, 2 Jan 1996 14:39:08 PST
Message-Id: <9601022244.AA04194@alice.jcc.com>


At 02:57 PM 1/2/96 -0500, you wrote:
>Does anyone have any nifty work arounds for grouping null values?
>
>ex/
> Select nvl(column1, 0), count(column1) from table1
> group by column1;
>
>If the values in the database are 1,2,3 and NULL it returns
>
>column1 Count(column1)
>------- --------------
>1 7
>3 4
>3 12
>0 0 I know there are null values in the table....
>
>Thanks in advance....
>------
>Robert
>
>
>|===========================================================|
>| Robert Sisk Phone: (803) 935-8136 |
>| SCT Utility Systems Email: rsisk_at_sctcorp.com |
>|===========================================================|
>

Hi

You have to count values in column1.
Hence you should put nvl(column1,0) in count.

 select column1, count( nvl(column1,0))  from table1
group by column1

I hope this helps. Have a nice day.



Pratap Singh

Email: singhp_at_bactc.com
Voice: 415-827-5868
Fax: 415-266-6324



Wishing you a happy and prosperous new year.
Received on Tue Jan 02 1996 - 17:44:43 CST

Original text of this message

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