I have a huge table that has 1,990,546 users with numerous data. Sometimes I get email lists and dump them into this table also.
I want to delete users with duplicate email addresses. However, I want to keep users
WHERE chips > 0.
This query ran for over an hour before I terminated it:
SELECT id, email FROM users WHERE id IN ( SELECT a.id FROM users a, users b WHERE (a.email = b.email) AND (a.chips > 0) ) LIMIT 100;
Is there a faster or better way to do this?