应用场景:
表a为主表,表b为备份表,当表a的数据出现问题,需要根据表b的数据进行回滚
sql:
update test a inner join (select
b.id,
c.name,
c.address
from test b left join test_tmp c on b.id = c.id) d on a.id = d.id
set
a.address = d.address,
a.name = d.name;
应用场景:
表a为主表,表b为备份表,当表a的数据出现问题,需要根据表b的数据进行回滚
sql:
update test a inner join (select
b.id,
c.name,
c.address
from test b left join test_tmp c on b.id = c.id) d on a.id = d.id
set
a.address = d.address,
a.name = d.name;