1 2 3 4 5 6 |
SELECT COUNT(*) as repetitions, campaign,client FROM cmdata GROUP BY client,campaign HAVING repetitions > 1 |
This SQL will delete any duplicates in campaignid, and keeps the higher id one
1 2 3 |
DELETE u1 FROM targets u1, targets u2 WHERE u1.id < u2.id AND u1.campaignid = u2.campaignid |