use*_*217 2 sql postgresql sql-update
比方说,我有表table1
的列id
,value
并table2
与列table1_id
,value
。
如果匹配,我将如何编写Postgresql查询来更新table1.value
(整个表,而不仅仅是一行)?table2.value
table1.id = table2.table1_id
预先感谢您的答复!
您使用一个from
子句。在Postgres中,这看起来像:
update table1
set col1 = . . .
from table2
where table1.id = table2.table1_id
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2974 次 |
最近记录: |