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

Home -> Community -> Usenet -> c.d.o.server -> Re: count(*) includes null record with group by function

Re: count(*) includes null record with group by function

From: Mlevison1 <mlevison1_at_aol.com>
Date: 19 Nov 1998 06:04:29 GMT
Message-ID: <19981119010429.11437.00003449@ng95.aol.com>

  1. Change the select clause.
  2. The group by clause does not cause NULL records to be rejected.
  3. Are you applying the outer join operator (+) to the correct side of the equation?

select tab_b.outlet_id,sales_id,pack_id, count(*) from tab_a, tab_b
{
where tab_a.outlet_id (+)= tab_b.outlet_id

The outer join operation should be on the table that has fewer of these values, i.e. is a subset of the other table.
If neither table is a subset of the other in terms of the outlet_id, then you need something a bit more complicated, a "union" operator.

select count(tab_b.outlet_id), sales_id,pack_id from tab_a, tab_b
where tab_a.outlet_id *= tab_b.outlet_id Received on Thu Nov 19 1998 - 00:04:29 CST

Original text of this message

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