[英]Update a column of a table with data from another table if columns match PostgreSQL
您似乎想要从另一个表进行update
。 语法如下所示:
update table1
set column1 = table2.column1
from table2
where table1.column2 = table2.column2;
在您的问题中,我无法跟随列名的变化,但这是从一个表更新另一个表中的列的结构。
这应该做到-
update table1
set column1.2 = table1.column1.2 || ' ' || table2.column2.1
from table2
where table1.column1.1 = table2.column2.2;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.