重複データの一括更新

588 ワード

原因:同郷会会員ログの登録を重荷し、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')