0

Possible Duplicate:
How to delete duplicate rows from a MySQL table

I've a mysql table with duplicate records and I want to delete all duplicate records. How can I do this? My table has only a few columns and 1 column can have duplicate records. It's a about a registration of user and I don't want an e-mail to be registerd twice. I cannot check the e-mail before it's entered because it would complicate the registration process and it has to be as simple as possible.

Community
  • 1
  • 1
Micromega
  • 12,486
  • 7
  • 35
  • 72

1 Answers1

0

You can perform a self-join in the multiple-table form of DELETE:

DELETE u1
FROM   users u1 JOIN users u2 USING (email)
WHERE  u1.timestamp < u2.timestamp
eggyal
  • 122,705
  • 18
  • 212
  • 237