-1

我在一个表中有 4 列,需要逐行添加这些列,并且这个结果需要在 postgres 中逐行更新到另一个表的列中。

4

1 回答 1

0

在 Postgres 中,您可以fromupdate. 你的问题有点含糊,但是是这样的:

update toupdate
    set sumcol = (t1.col1 + t1.col2 + t1.col3 + t1.col4)
    from table1 t1
    where t1.? = toupdate.?;

?用于标识两个表之间的行如何匹配的列。

于 2018-09-25T11:37:03.163 回答