title: Postgres INSERT INTO with SELECT
body: <p>I'm trying to write some SQL to insert records into a PG table.</p>
  
  <p>This is the logic:</p>
  
  <ul>
  <li>For every record in the costprojects table that has coststatus_id=1</li>
  <li>insert a new record into costestimates table
  
  <ul>
  <li>costcat_id=30, amount=0, costproject_id=costproject.id(from the costprojects record) , maintenance=‘FALSE’, position=22</li>
  </ul></li>
  </ul>
  
  <p>This is the SQL code I tried:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>I get ERROR: syntax error at or near "("</p>