Link to home
Start Free TrialLog in
Avatar of Jay R
Jay R

asked on

Finding duplicate records in tables

I have a table with some duplicate records in them

Can someone please suggest the best or most efficient way of quickly finding out duplicates in a table & print those records out.
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Which fields should we query to know that the record is duplicated (ID, name, ...)?
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw I see this is your first week here, so welcome to EE.
HI Jay,

For example, If you want to check duplicate Email in one of the column in a table

SELECT email,
 COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )