简体   繁体   English

INNER JOIN后两个表的SQL更新

[英]SQL Update after INNER JOIN two tables

I would like Update two tables on the same Update statement with INNER JOIN but I cant attach second table 我想使用INNER JOIN在同一Update语句上Update两个表,但无法附加第二个表

UPDATE T1 SET T1.status='test1', T2.status='test1' 
FROM mytable1 T1 
INNER JOIN table2 T2 ON T1.id=T2.id 
WHERE parameters.....

But I cant use T2.status='test1' error I am getting 但是我无法使用T2.status='test1'错误

The multi-part identifier "T2.status" could not be bound. 多部分标识符“ T2.status”无法绑定。

You can't update 2 tables in a single update statement, even if using join clause. 即使使用join子句,也无法在单个update语句中更新2个表。 The join clause can be used for "filtering" purposes only. join子句只能用于“过滤”目的。 Only FROM table can be updated. 仅FROM表可以更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM