1、查询重复的数据:select * from 表 where id in (select Id from 表 group by id having count(id) > 1)
2、表中只有一条重复的情况下删除方法:DELETE from 表 WHERE (id) IN ( SELECT id FROM 表 GRO炽扃仄呦UP BY id HAVING COUNT(id) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM 表 GROUP BY id HAVING COUNT(*) > 1);
3、表中有多条重复的数据:delete from 表 t where t.rowid in (select min(rowid) from 表 t1where t1.id=t.id and t1.age=t.age group by id having count(*)>1)
4、根据第三步的方法,可以判断多个字段的重复数据。根据需要,自己在后面添加判断的条件。
5、还有一个需要注意的地方就是 in 和 not in ,根据需要自己选择。亲测y有效。