或者是这个意思?update cdb_members a ,uchome_show b set a.credits=a.credits+b.credit,b.credits=a.credits+b.credit where a.uid=b.uid;
1.你的MySQL数据库版本在5.1.6以上 2.确保event_scheduler已开启 就可以定时执行了跟计划任务一样,举个例子:(每天合计你两个表里的值)CREATE EVENT test ON SCHEDULE EVERY 1 DAY DO update cdb_members a ,uchome_show b set a.credits = a.credits + b.credit , b.credits = a.credits + b.credit where a.uid = b.uid;
set a.credits=a.credits+b.credit,b.credits=a.credits+b.credit
where a.uid=b.uid;
2.确保event_scheduler已开启
就可以定时执行了跟计划任务一样,举个例子:(每天合计你两个表里的值)CREATE EVENT test
ON SCHEDULE EVERY 1 DAY
DO update cdb_members a ,uchome_show b set a.credits = a.credits + b.credit , b.credits = a.credits + b.credit where a.uid = b.uid;