Category Archives: MySQL

Select duplicate rows from a table

flattr this!

Every now and then you might want to see rows which are duplicate (or appear more than once in a table). For example, in a table of ZIP codes, you will not want the ZIP codes to be repeated and the query below will help you in finding any duplicates:

SELECT DISTINCT column_name
FROM table_name
GROUP BY column name
HAVING COUNT(column_name) > 1

Brilliant or what ;)