select 附近的 PostgreSQL returns 语法错误的子查询
Subqueries for PostgreSQL returns syntax error near select
我是数据库的初学者,我正在尝试 运行 子查询将数据从一个 table 插入到另一个具有相同模式的数据。
insert into tbl_technologies_used (t_name_tech, t_category_tech, i_rating)
values (
select t_name_tech, t_category_tech, i_rating
from tbl_technologies_proposed
);
但是我得到了这个错误:
ERROR: syntax error at or near "select"
LINE 1: ... (t_name_tech, t_category_tech, i_rating) values (select t_n...
我该如何解决这个问题?我反复检查我的代码,但我找不到错误。
如果 INSERT 的来源是 SELECT,则不能使用 VALUES
:
insert into tbl_technologies_used (t_name_tech, t_category_tech, i_rating)
select t_name_tech, t_category_tech, i_rating
from tbl_technologies_proposed
values
子句提供了一组静态行,这不是必需的,因为要插入的行来自您的 SELECT 语句。
我是数据库的初学者,我正在尝试 运行 子查询将数据从一个 table 插入到另一个具有相同模式的数据。
insert into tbl_technologies_used (t_name_tech, t_category_tech, i_rating)
values (
select t_name_tech, t_category_tech, i_rating
from tbl_technologies_proposed
);
但是我得到了这个错误:
ERROR: syntax error at or near "select"
LINE 1: ... (t_name_tech, t_category_tech, i_rating) values (select t_n...
我该如何解决这个问题?我反复检查我的代码,但我找不到错误。
如果 INSERT 的来源是 SELECT,则不能使用 VALUES
:
insert into tbl_technologies_used (t_name_tech, t_category_tech, i_rating)
select t_name_tech, t_category_tech, i_rating
from tbl_technologies_proposed
values
子句提供了一组静态行,这不是必需的,因为要插入的行来自您的 SELECT 语句。