Blog by Andreas Glaser

Tag: Duplicates

SQL / Mysql - How to find and count duplicates

by Andreas Glaser on Oct.22, 2008, under Computer, Development, SQL

Some developers facing the problem of duplicates in sql/mysql tables. To find and count them use the following statement.

1
2
3
4
SELECT ID, count(*) as Amount
FROM name_of_the_table
GROUP BY ID
HAVING  Amount > 1

Just replace the used table “name_of_the_table” and the column “ID” which is inspected for duplicates. The output shows you the record which is multiple times in the table and the amount of it.

So long,
Andreas Glaser (aka JaZz)

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...