Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Add zero for null in count?
Hey. I have a SQL*Plus query where I'm counting unique values. How
can I get it to return a zero if no data matches the query's criteria?
Here's my query:
SELECT distinct r.dstr_nr, COUNT(DISTINCT r.RGSN_ID) "DAILY TOTAL"
FROM RGSN r
WHERE r.DSTR_NR between 1603 and 1700
and trunc(applied_dt) = '12-SEP-2006'
group by r.dstr_nr
order by r.dstr_nr desc
/
Let's say it's displaying this right now...
DSTR_NR DAILY TOTAL 1603 153 1604 23 1606 98 I want it to display this... DSTR_NR DAILY TOTAL 1603 153 1604 23 1605 0 1606 98 1607 0
Any help is appreciated.
Thanks,
-Danny
Received on Wed Sep 13 2006 - 15:52:09 CDT
![]() |
![]() |