码迷,mamicode.com
首页 > 数据库 > 详细

去除数据库的重复数据

时间:2018-01-29 17:40:47      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:gre   group   重复数   date   str   body   div   update   min   

UPDATE ptop_investrecord set delflag = 1 where id in (SELECT o.id from (SELECT uid,min(id) as id,count(uid) as num 
from ptop_investrecord 
where cid = 1578  and progress = 1  and comefrom = 5 AND delflag = 0 GROUP BY uid,flagname,money HAVING num >1) as o);

只对老的数据进行更改

去除数据库的重复数据

标签:gre   group   重复数   date   str   body   div   update   min   

原文地址:https://www.cnblogs.com/matengfei123/p/8378106.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!