Skip to content

Commit

Permalink
Add SQL for finding duplicate records
Browse files Browse the repository at this point in the history
  • Loading branch information
rosenfeld committed Aug 3, 2011
1 parent d433d4c commit ba6b25f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions en/databases/sql/finding-duplicates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Finding duplicate records with same column(s) value

Sometimes, this is useful if you have an inconsistent database and are unable to create a unique index in 2 fields:

SELECT * FROM table_name a WHERE 1 < (SELECT count(*) FROM table_name b WHERE a.column1 = b.column1 AND a.column2 = b.column2)

0 comments on commit ba6b25f

Please sign in to comment.