Posts Tagged ‘sql query’

Find Duplicate Records – SQL Query

| July 29th, 2008 | Comments Off | Development

Clueless UsersHere’s a real simple query to detect duplicate records (based on a single field). This query works in both MySQL and Microsoft SQL.
SELECT FieldName, COUNT( FieldName ) AS Occurrences
FROM TableName
GROUP BY FieldName
HAVING ( COUNT( FieldName ) > 1 )