How to Find Duplicates in a Table using SQL


Write an SQL statement to find rows with duplicate column values in a database table


You need to group by the column containing the duplicate values then select only the groups with count greater than 1


Here is the code in SQL

Select field, count(field)
from table 
group by field 
having count(field) > 1

Leave a Reply