0

I have a table Emails with the following fields:

ID|Email                |Bounced|GroupID
----------------------------------------
1 |**[email protected]**|0      |1
2 |**[email protected]**|1      |2
3 |[email protected]    |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

4
  • possible duplicate of Finding duplicate values in a SQL table Apr 4, 2015 at 5:23
  • Thanks David, but it doesn't look duplicate to me..that was different question I can't use. Apr 4, 2015 at 5:41
  • Can you explain (in your question, if possible) how the question differs? It seemed close enough to me. Apr 4, 2015 at 5:42
  • edited...hope it answers the question..Thank you Apr 4, 2015 at 5:44

1 Answer 1

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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.