How to find duplicate records in mysql

 

IF you want to find duplicate records in a table, you can use the following query

In this query we use Count() function , Group By and Having clause

 

SELECT

Column_name,

COUNT(Column_name)

FROM

table_name

GROUP BY Column_name

HAVING COUNT(Column_name) > 1;

mysql My info adda

 

For example in my case in my USER table, I want to check how many duplicates names so I wright query

 

SELECT

firstname,

COUNT(firstname)

FROM

user

GROUP BY firstname

HAVING COUNT(firstname) > 1;

 

my info adda How to find duplicate records in mysql

You may also like