I have a table called
leads with duplicate records
Leads: *account_id *campaign_id
I want to remove all the duplicate
campaign_id equal to "51"
For example, if
account_id = 1991 appears two times in the table then remove the one with
campaign_id = "51" and keep the other one.
You could use a delete join:
DELETE t1 FROM yourTable t1 INNER JOIN yourTable t2 ON t2.account_id = t1.account_id AND t2.campaign_id <> 51 WHERE t1.campaign_id = 51;
Answered By – Tim Biegeleisen