1 2 3 4 |
select CONCAT(client,campaign),id FROM cmdata WHERE id IN (SELECT id FROM cmdata GROUP BY campaign HAVING COUNT(*) > 1) |
Or also very effective , this will work if both the fields are the same…..(like a concat)
1 2 3 4 5 6 7 |
delete from cmdata USING cmdata, cmdata as vtable WHERE (cmdata.id > vtable.id) AND (cmdata.campaign=vtable.campaign) AND (cmdata.client=vtable.client) |