“重复记录”一种是完全重复的记录,即所有字段都重复的记录
select distinct * from tableName //得到不是重复的记(重复的记录只取一条)
二种是关键字段重复的记录
select * from tableName where id in ( select id from tableName group by id having count(*)>1 ) //得到重复的记录
delete from tableName where id in ( select id from tableName group by id having count(*)>1 ) and rowid not in ( select max(rowid) from tableName group by id having count(*)>1 )//删除重复记录 ID包含于 重复记录中 并且 rowid 等于max(rowid) 也就是保留重复ID的max(rowid)的记录