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 -> HELP! Having Count Question

HELP! Having Count Question

From: oranewbie <kellywh_at_hotmail.com>
Date: 16 Dec 2002 12:46:29 -0800
Message-ID: <947ef647.0212161246.2796a2e3@posting.google.com>


I'm running counts against a table with 15,467,245 rows.

When I run a count on a table using distinct(id) I get the following results:

select count(distinct(id)) from emp;



15,254,678

15,467,245 - 15,254,678 = 312,567 duplicates (easy right)

However, when I try to pull off the duplicates with the having count(*). I get a different set of numbers:

select count(*) from (select (account_id from emp having count(*) > 1 group by
account_id);



302,831 duplicates

So, the having count(*) clause gives me 302,831 duplicates and distinct count gives me 312,567 duplicates. This doesn't make since to me. There aren't any nulls in the id either. Any guru's have any suggestions?

thanks for your time, Received on Mon Dec 16 2002 - 14:46:29 CST

Original text of this message

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