SQL语句联表更新语句(MySql和SQlServer)MySql联表更新语句:
update table1 t1 inner join (select * from table2 where id= ?)  t2
on t1.id = t2.id set t1.name= t2.name;
SqlServer联表更新语句:
update  a3
set a3.state = a2.state
from table3 a3 inner join
(select t1.*, t2.test_id from table1 t1 left join table2 t2 on t1.c_id= t2.id
where  t1.id= ?) a1 on a1.id = a3.id
inner join (select t1.state, t2.test_id from table1 t1 left join table2 t2 on t1.c_id = t2.id
where t1.id= ?) a2 on  a2.test_id= a1.test_idsqlserver备份表语句
where  a3.c_id= ?