1.查重:
select * from file a
where (a.name) in (select name from file WHERE isDelete = 0 and status = 1 GROUP BY phone HAVING count(*)>1);
2.删除
DELETE a FROM file a, file b
WHERE a.id < b.id AND a.name
= b.name
;
3.修改重复状态
update file set status =0 where id in(
select * from (
select id from file a
WHERE (a.name) IN (
SELECT name FROM file where status =1
GROUP BY name HAVING
count() > 1)
and a.id NOT IN (
SELECT id FROM file
GROUP BY name HAVING count() > 1)) m )