Re: Add zero for null in count?
- From: DA Morgan <damorgan@xxxxxxxxx>
- Date: Thu, 14 Sep 2006 21:04:23 -0700
Dan-X ! wrote:
Thanks for the responses. I actually figured out a solution on my own.
Below is my revised query that works.
select distinct r.dstr_nr, count(distinct x.rgsn_id) "DAILY TOTAL"
from rgsn r, (select applied_dt, rgsn_id, dstr_nr from rgsn where
dstr_nr between 1603 and 1700 and trunc(applied_dt) = '13-SEP-2006')x
where r.dstr_nr between 1603 and 1700
and r.rgsn_id = x.rgsn_id(+)
group by r.dstr_nr
order by r.dstr_nr desc
/
A far better solution would be to write a pipelined table function
and join to it. You can find a demo of this in Morgan's Library at
www.psoug.org.
--
Daniel Morgan
Puget Sound Oracle Users Group
.
- References:
- Add zero for null in count?
- From: dan-x
- Re: Add zero for null in count?
- From: Dan-X !
- Add zero for null in count?
- Prev by Date: TNS could not resolve service name when connect RAS
- Next by Date: Re: Data quality ranking problem
- Previous by thread: Re: Add zero for null in count?
- Next by thread: Refcursor as parameter to function
- Index(es):