一.删除数据库中的重复数据, 只留一条
1 -- 删除数据库中的重复数据只留一条 2 DELETE 3 FROM 4 crm_member 5 WHERE 6 id IN ( 7 SELECT 8 a.id 9 FROM10 (11 SELECT12 id 13 FROM14 crm_member 15 WHERE16 phone IN ( SELECT phone FROM crm_member GROUP BY phone HAVING count( phone ) > 1 ) 17 AND id NOT IN ( SELECT min( id ) FROM crm_member GROUP BY phone HAVING count( phone ) > 1 ) 18 ) a 19 )