MySQL: How to Count Duplicated Records

The following query can be used to count duplicated records in MySQL:

SELECT count(*) AS duplicate_count
FROM (
 SELECT column_name FROM table
 GROUP BY column_name HAVING COUNT(column_name) > 1
) AS t

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.