Wednesday, September 16, 2009

How to find duplicate Rows in SQL

Find the duplicate rows in a mysql table

SELECT username,
COUNT(username) AS NumOccurrences
FROM users
GROUP BY username
HAVING ( COUNT(username) > 1 )

No comments:

Post a Comment