如何在postgresql中插入其他table的列

How to insert column of other table in postgresql

我想插入其他 table 的一列,而此 table 的一个参数具有硬编码值。我想用其他 table 列的每个 return 值迭代此值。我如何使用插入查询执行此操作?

令3,4,6为其他table的return列值。

insert into table(value1,value2)
values (2,select id from table2)

Return列

2       3
2       4
2       6

删除 values 子句:

insert into table(value1,value2)
select 2, id 
from table2