delete duplicate as a from duplicate as a,(select * from duplicate group by name having count(1)>1) as b where a.name=b.name and a.id > b.id;