Skip to main content

MySQL query to find duplicate records.

select id, count(*) as n
from table
group by id
having n > 1;

-- or

select count(id), id
from table
group by id
having count(id) > 1
order by id;