← Back to Gists

Find duplicates using GROUP BY

📝 SQL
aellis
aellis · Level 6 ·

Groups rows by a column and filters for those with more than one occurrence to find duplicate values.

SQL
SELECT columnname, COUNT() AS occurrencecount
FROM tablename
GROUP BY columnname
HAVING COUNT() > 1;

Comments

No comments yet. Start the discussion.