下面的sql可以查询数据库中对应字段的重复数据,并展示
Select * From 表名 Where 字段名称 In (Select 字段名称 From 表名 Group By 字段名称 Having Count(*)>1)
删除重复数据只留其中一条
DELETE FROM 表名 where id not in (select id from (select min(id) as id from 表名 group by 字段名称) as b ) ;
下面的sql可以查询数据库中对应字段的重复数据,并展示
Select * From 表名 Where 字段名称 In (Select 字段名称 From 表名 Group By 字段名称 Having Count(*)>1)
删除重复数据只留其中一条
DELETE FROM 表名 where id not in (select id from (select min(id) as id from 表名 group by 字段名称) as b ) ;