SQL Find Duplicates Query
Needed this today. Finds all occurences of a specified field that occurs more than once (or whatever number you want to replace)
also this finds only lines that have a single record
SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )
also this finds only lines that have a single record
SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )
0 Comments:
Post a Comment
<< Home