Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> HELP! Having Count Question
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,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);
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
![]() |
![]() |