先查询重复记录值

select * from tbname where uid in (select uid from tbname group by uid having count(uid)>1);

能查询,应该就能删除

delete from tbname where uid in (select uid from tbname group by uid having count(uid)>1);

但是报错:You can't specify target table,意思是目标表不明确

修改sql语句,将查询结果放入一个临时表
delete from tbname where uid in (
select tmptb.uid(
select uid from tbname group by uid having count(uid)>1
) as tmptb
);