mysql 重复数据只留一条

来源:互联网 发布:淘宝返利微信 编辑:程序博客网 时间:2024/06/05 09:50
delete a from kol_contacts a,
 (select c.kol_id,c.mobile ,max(c.id) as  bid from 
  kol_contacts c  GROUP BY kol_id,mobile having count(*) >1
 ) b
 where a.kol_id=b.kol_id and a.mobile = b.mobile and a.id < b.bid;

0 0