1、根据rowid来查询重复数据
select * from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 )
2、根据rowid来删除重复数据
delete from table1 a where rowid !=(select max(rowid)
from table1 b where a.name1=b.name1 )
3、根据group by来查询重复数据
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
4、删除表中多余的重复记录,重复记录是根据单个字段(Id)来判断,只留有rowid最小的记录
delete from people
where Id in (select Id from people group by Id
having count(Id) > 1)
and rowid not in (select min(rowid) from people group by Id having count(Id)>1)
5、查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from 表 a where (a.Id,a.seq) in (select Id,seq from 表 group by Id,seq having count(*) > 1) and rowid not in (select min(rowid) from 表 group by Id,seq having count(*)>1)