//查看所有保留最大ID
select * from [表名] where [字段ID] not in(select min([字段ID]) from [表名] group by [去重的字段])
//查看所有保留最小ID
select * from [表名] where [字段ID] not in(select max([字段ID]) from [表名] group by [去重的字段])
//统计每一个重复记录条数
//SELECT [去重的字段],Count() FROM [[表名]] GROUP BY [[去重的字段]] HAVING Count()>1;
//所有重复记录保留最小ID
delete from [表名] where [字段ID] not in(select min([字段ID]) from [表名] group by [去重的字段])
//所有重复记录保留最大ID
delete from [表名] where [字段ID] not in(select max([字段ID]) from [表名] group by [去重的字段])
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询