Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果另一个表中存在特定值,我需要更新表中的值。
IE
update table1 set value1=3 where table2.value2='Y'
两个表中都有一个键ref1- 我如何使用这个键将它们链接在一起?非常感谢!
ref1
update table1 inner join table2 on table1.ref1 = table2.ref1 set value1 = 3 where table2.value2 = 'Y'
您可以在两个表之间编写连接,然后从连接中进行更新。
就像是:
update tableA set column = b.value from tableA a join tableB on a.key = b.key