合并数据库重复记录处理

1.update mem_localmemberbaseinfo set balance=(
                                        select b from (select count(uniqueid) as a,sum(balance) as b
                                                        group by uniqueid having count(uniqueid)>1) x) where uniqueid=
                                                                  (select d from (select count(uniqueid) as c,uniqueid as d group by uniqueid having count(uniqueid)>1) x) and id>100000;
2.delete from mem_localmemberbaseinfo where uniqueid=(select d from (select count(uniqueid) as c,uniqueid as d group by uniqueid having count(uniqueid)>1) x) and id<100000;

posted on 2013-10-09 11:49  awk  阅读(400)  评论(0)    收藏  举报

导航