Postgresql Postgres:作为多行插入的一部分从另一个表中插入值?

Postgresql Postgres:作为多行插入的一部分从另一个表中插入值?,postgresql,Postgresql,我在Postgres 9.6中工作,希望使用insert-INTO查询在单个查询中插入多行 作为插入的值之一,我还希望从另一个表中选择一个值 这就是我尝试过的: insert into store_properties (property, store_id) values ('ice cream', select id from store where postcode='SW1A 1AA'), ('petrol', select id from store where postc

我在Postgres 9.6中工作,希望使用
insert-INTO
查询在单个查询中插入多行

作为插入的值之一,我还希望从另一个表中选择一个值

这就是我尝试过的:

insert into store_properties (property, store_id) 
values 
  ('ice cream', select id from store where postcode='SW1A 1AA'),
  ('petrol', select id from store where postcode='EC1N 2RN')
;
但是我在第一次选择时遇到语法错误。我做错了什么

请注意,该值是按行确定的,也就是说,我不是直接从另一个表复制值

有一些牙套不见了。每个数据集都必须用大括号和
SELECT
语句包围

我不知道您的表结构,但可能还有另一个错误:第一个数据集由
邮政编码
列过滤,第二个数据集由
属性
列过滤…

有一些牙套不见了。每个数据集都必须用大括号和
SELECT
语句包围


我不知道您的表结构,但可能还有另一个错误:第一个数据集由
邮政编码
列过滤,第二个数据集由
属性
列过滤…

@Richard不客气:如果您能作为well@Richard不客气,如果你也能投票,我将不胜感激
insert into store_properties (property, store_id) 
values 
('ice cream', (select id from store where postcode='SW1A 1AA')),
('petrol', (select id from store where property='EC1N 2RN'))