首页 > 代码库 > Access数据库删除重复记录,只保留一条记录的做法

Access数据库删除重复记录,只保留一条记录的做法

Access数据库删除重复记录,只保留一条记录的做法:只保留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 [带重复记录的字段名称])

 

Access数据库删除重复记录,只保留一条记录的做法