← Back to Gists

find duplicates by column

📝 SQL
shawn_henry99
shawn_henry99 · Level 4 ·

This SQL snippet finds rows with duplicate values in a specified column by grouping and counting occurrences.

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

Comments

No comments yet. Start the discussion.