Find duplicate records in MySQL

Solution for :I want to pull out duplicate records in a MySQL Database.

The key is to rewrite this query so that it can be used as a sub-query.

EXAMPLE QUERY:

SELECT firstname, 
   lastname, 
   list.address 
FROM list
   INNER JOIN (SELECT address
               FROM   list
               GROUP  BY address
               HAVING COUNT(id) > 1) dup
           ON list.address = dup.address;

No comments:

Post a Comment