批量更新重复数据

原因:重负注册老乡会会员日志,增加 400积分。

解决:设置该积分0

UPDATE sz_app_credit_log AS a 
LEFT JOIN (SELECT uid,lid,MIN(lid) FROM sz_app_credit_log
WHERE appid=7 and oreason LIKE '%老乡会会%' 
AND dateline>=UNIX_TIMESTAMP('2011-10-01') AND dateline<UNIX_TIMESTAMP('2011-11-01')
GROUP BY uid HAVING COUNT(1)>1 ORDER BY uid ) AS b 
ON a.uid=b.uid 
SET a.ovalue=0,a.oreason='注册老乡会会员_错误'
WHERE a.lid>b.lid  and appid=7
AND a.dateline>=UNIX_TIMESTAMP('2011-10-01') AND a.dateline<UNIX_TIMESTAMP('2011-11-01')


你可能感兴趣的:(JOIN,unix)