Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Grouping NULL values
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.
Email: singhp_at_bactc.com
Voice: 415-827-5868
Fax: 415-266-6324