查询重复数据:
#查询重复数据 SELECT mobile, activity_id, COUNT(*) as count FROM zwsearch_user GROUP BY mobile, activity_id HAVING COUNT(*) > 1;
删除重复数据:
#删除重复数据 DELETE t1 FROM zwsearch_user t1 INNER JOIN ( SELECT MIN(id) AS min_id,activity_id,mobile FROM zwsearch_user GROUP BY activity_id, mobile HAVING COUNT(*) > 1 ) t2 ON t1.activity_id = t2.activity_id AND t1.mobile = t2.mobile WHERE t1.id > t2.min_id;