Cleaning duplicate records with SQL

I needed a way to clean out a MySQL table of records with duplicate email addresses. To do this I used a simple SELECT query inside of an INSERT.

INSERT INTO
    good_users(email)
        SELECT
            DISTINCT(email)
        FROM
            bad_users

Published by

Adam

Application Architect from Florida

Leave a Reply

Your email address will not be published. Required fields are marked *