[vc_row][vc_column][vc_column_text]
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
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]SELECT
Column_name,
COUNT(Column_name)
FROM
table_name
GROUP BY Column_name
HAVING COUNT(Column_name) > 1;
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_single_image image=”1915″ img_size=”full”][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]
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;
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_single_image image=”1916″ img_size=”full”][/vc_column][/vc_row]