I'm trying to write some SQL to insert records into a PG table.
This is the logic:
This is the SQL code I tried:
INSERT INTO costestimates (costcat_id, amount, costproject_id, maintenance, position) VALUES (30, 0, costproject.id, false, 22)
(SELECT id FROM costprojects WHERE coststatus_id=1)
I get ERROR: syntax error at or near "("
答案 0 :(得分:3)
它应该是这样的:
INSERT INTO costestimates (costcat_id, amount, costproject_id, maintenance, position)
SELECT 30, 0, id, false, 22 FROM costprojects WHERE coststatus_id=1;
答案 1 :(得分:0)
你的语法有点偏;你想要的是使用你的SELECT语句实际组成VALUES列表。
尝试这样的事情:
rm $( find node_modules -name .babelrc)