表A,字段1表B,字段1如何一条sql更新两张表?设置字段1=100,字段2=200update 表A,表B,set 表A.字段1......这样吗?
UPDATE table1 AS a, table2 AS b, table3 AS c, ... SET a.name = 'W', b.name = 'T', c.name = 'F', ... WHERE a.id = 1 AND b.id = 2 AND c.id = 3
However, it is not recommended to perform update operations on two tables with unrelated requirements in one SQL.
update
It is recommended to start a transaction to complete the update operation of the two tables. start transaction;update table A;update table B;commit;
Why not give it a try?
Such an amazing idea
However, it is not recommended to perform
update
operations on two tables with unrelated requirements in one SQL.It is recommended to start a transaction to complete the update operation of the two tables.
start transaction;
update table A;
update table B;
commit;
Why not give it a try?
Such an amazing idea