View Single Post
  #3 (permalink)  
Old 04-17-2006, 01:41 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 87
ben has disabled reputation
Default MySQL answer. Re: Find duplicate entries in a table?

Another approach is to list all the duplicate entries. We assume the field 'id' is the primary key of the table 'users'

[sql]
SELECT DISTINCT t1.id, t1.email FROM users t1, users t2 WHERE t1.email = t2.email AND t1.id <> t2.id
[/sql]
Reply With Quote