title: Oracle - Updating table based on field from another table
body: <p>I have a Task table and a Project table. I'm trying to update the Percent Complete field in the Project table with the value of the Percent Complete field from the Tasks table. But I only want to update the field when the sequence code from the Task table is equal to 1. My failed attempt looks like this:</p>
  <pre><code>UPDATE inv_projects prj
  SET prj.percent_complete = (SELECT NVL(tsk.prpctcomplete, 0)
                              FROM prtask tsk
                              WHERE tsk.prprojectid = prj.prid)
  WHERE (SELECT tsk.prwbssequence
         FROM prtask tsk
         WHERE prj.prid = tsk.prprojectid) = 1;
  </code></pre>
  <p>I'm getting the error:</p>
  <pre><code>Error starting at line : 1 in command -
  ...
  Error report -
  ORA-01427: single-row subquery returns more than one row
  </code></pre>
  <p>I'm not quite sure what's going wrong.</p>