• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

get a count of duplicates

How can I count the number of duplicates in a table.  Thanks
0
running32
Asked:
running32
  • 2
  • 2
1 Solution
 
slightwv (䄆 Netminder) Commented:
On all columns or just certain columns?


0
 
running32Author Commented:
a count and all columns.

thanks
0
 
slightwv (䄆 Netminder) Commented:
Try the code below.  just add the columns to the where clause.
drop table tab1 purge;
create table tab1(col1 char(1), col2 char(1));

insert into tab1 values('a','b');
insert into tab1 values('a','b');
insert into tab1 values('a','b');
insert into tab1 values('c','d');
commit;

select count(*)
from tab1 t1
where rowid>(select min(rowid) from tab1 t2 where
	t1.col1=t2.col1 and
	t1.col2=t2.col2
)
/

Open in new window

0
 
running32Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now