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: Add zero for null in count?

Re: Add zero for null in count?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 14 Sep 2006 22:06:09 +0200
Message-ID: <dfdjg2pnf5urd72sdg97vkqd8cogibvtse@4ax.com>


On 14 Sep 2006 10:22:25 -0700, "Dan-X !" <dan-x_at_yahoo.com> 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
>/

It may work and it may not, as you have a cartesian product. In any case it is DAMN inefficient, and it is not going to scale, so I predict serious performance problems in the future.

--
Sybrand Bakker, Senior Oracle DBA
Received on Thu Sep 14 2006 - 15:06:09 CDT

Original text of this message

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