postgresql multiple insert with select query
i need to perform a insert query for multiple rows whereby the first column is a numeric and identi开发者_如何学JAVAcal value and the second values are queried from another table.
something like
insert into table (33, select col2 from another_table);
can this be accomplished with a single statement?
like this
insert into table
select 33, col2 from another_table;
If you want to specify columns in your insert query, you should use this syntax:
INSERT INTO table (id, col2_name) (SELECT 33, col2 FROM another_table);
精彩评论