SQL Update多表关联修改
1、SqlServer
UPDATE a SET a.a1=b.b1,a.a2=b.b2 FROM A a INNER JOIN B b ON a.a3=b.b3
Update 后面跟 别名,From后的条件就可以跟Select一样来写了
2、Oracle
UPDATE A a SET (a.a1,a.a2)=(SELECT b.b1,b,b2 FROM B b WHERE b.b3=a.a3)
3、MySql
UPDATE A a , B b SET a.a1 = b.b1 , a.a2 = b.b2 WHERE a.a3 = b.b3