Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: count(*) includes null record with group by function
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