I have a database of around 126K entries, It has many entries having duplicate emails. I want to delete all the entries with duplicate ones and just the keep the one that was created earliest.
I tried using the following query but it takes forever and maxes out my server bandwidth.
Can anyone help?
DELETE n1 FROM table n1, table n2 WHERE n1.ID > n2.ID AND n1.email = n2.email
Database Specifications
- PhpMyAdmin Version information: 3.5.3
- Server: Localhost via UNIX socket
- Software: MySQL
- Software version: 5.0.67-community - MySQL Community Edition (GPL)
- Protocol version: 10
- Server charset: UTF-8 Unicode (utf8)