title: Postgresql: insert with nested select and NEXTVAL in sequence
body: <p>I have sought and not found the answer to this problem:</p>
  
  <p>I insert a row using nested select but also need the uid sequence and datestamp</p>
  
  <p>SQL insert</p>
  
  <pre><code> insert into countdegreejob   (countdegreeid,jobid,uniquejobid,  id, created, updated) 
  
   select (cjtbdn.countdegreeid, j.id, j.uniquejobid ) NEXTVAL('hibernate_sequence'), now(), now()
   from job j 
  
   right join job_areasofstudy jd on j.id = jd.job_id
  
   inner join countjobtitlebydegreename cjtbdn on j.uniquejobid=cjtbdn.uniquejobid 
  
   where cjtbdn.degreename = jd.areasofstudy and jd.job_id is not NULL 
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>ERROR:  syntax error at or near "("
    LINE 2: ...jtbdn.countdegreeid, j.id, j.uniquejobid ) NEXTVAL('hibernat...</p>
  </blockquote>
  
  <p>Any help would be much appreciated</p>