PDA

View Full Version : Finding Duplicates



Guest.Visitor
01-01-1995, 02:00 AM
Anybody know how to list duplicate records in a file using SQL? Seems I've seen something about doing this once before... just can't seem to remember. Thanks, Brandon

Guest.Visitor
12-29-1999, 09:06 AM
Brandon, You should be able to do something like: select key1, key2, key3 from file group by key1, key2, key3 having count(*) > 1 -or if you care to know how many duplicates- select count(*), key1, key2, key3 from file group by key1, key2, key3 having count(*) > 1 -or if you care to know exactly what is on the records- select * from file a where exists (select key1, key2, key3 from file b group by key1, key2, key3 where a.key1 = b.key1 and a.key2 = b.key2 and a.key3 = b.key3 having count(*) > 1) (Could run for a while) David Morris