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)
Run Code Online (Sandbox Code Playgroud)
I get ERROR: syntax error at or near "("
Ild*_*sin 17
它应该是这样的:
INSERT INTO costestimates (costcat_id, amount, costproject_id, maintenance, position)
SELECT 30, 0, id, false, 22 FROM costprojects WHERE coststatus_id=1;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15676 次 |
最近记录: |