删除表中重复数据,只保留一条数据

方法一:

delete from dbyh where yhbh in(select yhbh from dbyh group by yhbh having count(*)>1) and
rowid not in (select min(rowid) from dbyh group by yhbh having count(*)>1);

方法二:

create table dbyh_tmp as select distinct * from dbyh;

drop table dbyh;

alter table dbyh_tmp rename to dbyh;

原文地址:https://www.cnblogs.com/steel-chen/p/7079048.html