mysql 数据去重

update ptop_investrecord set delflag = 1 where cid  = 250 and uid = 92569  and delflag = 0 and progress = 1 and comefrom = '5' and ptopRecordId = '253274'
and id not in (select tmp.myid FROM (SELECT min(id) as myid from  ptop_investrecord as tmp where cid  = 250 and uid = 92569  and delflag = 0 and progress = 1 and comefrom = '5' and ptopRecordId = '253274') as tmp);

 

标红的一定要加,创建临时表,不然mysql报错  You can't specify target table 'user' for update in FROM clause

posted @ 2017-09-30 11:25  matengfei  阅读(174)  评论(0编辑  收藏  举报