0

I have a table Emails with the following fields:

ID|Email                |Bounced|GroupID
----------------------------------------
1 |**email1@domain.com**|0      |1
2 |**email1@domain.com**|1      |2
3 |email2@domain.com    |0      |1

What I want to achieve is to delete duplicates from table Email_Table I.e. Remove both that have ID 1 and 2 and for all similar in table.

I found some MysQL code but it didn't do the job:

ALTER IGNORE TABLE email_table ADD UNIQUE INDEX(email,bounced);

How do I achieve this?

I am trying to remove bounced emails from interspire in whichever contact list they exist; sometimes the same email exists in two groups.

This is a unique question as I am not about to remove duplicate from one field...I need to remove duplicate in one field having it is available in many other groups with condition it has bounced value Thank you

Hassan Kazem
  • 81
  • 1
  • 6

1 Answers1

1

If you want to delete all rows with the same email that bounced at least once:

DELETE t1, t2 FROM Email_table t1 inner join Email_table t2 using (email) where t1.bounced = 1;
Jehad Keriaki
  • 545
  • 5
  • 10