title: T-SQL Update with SUM and Group BY
body: <p>I want to update with the value in this query, but it's saying it returns more than one value.</p>
  
  <pre><code>UPDATE PO_HEADER
    SET TOTAL = (SELECT SUM(LINE_TOTAL) AS "NEW_LINE_TOTAL" 
    FROM PO_LINE pl, PO_HEADER ph 
    where ph.IC_PO_HEADER = pl.IC_PO_HEADER 
    and ph.RELEASE_NUMBER = pl.RELEASE_NUMBER 
    group by pl.IC_PO_HEADER,pl.FOREIGN_KEY,ph.RELEASE_NUMBER,
    ph.REVISION_NUMBER,ph.PO_NUMBER)
  from PO_HEADER ph, PO_LINE pl
  where ph.IC_PO_HEADER = pl.IC_PO_HEADER;
  </code></pre>
  
  <blockquote>
    <p>Msg 512, Level 16, State 1, Line 1<br>
    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, &lt;, &lt;= , >, >= or when the subquery is used as an expression.</p>
  </blockquote>
  
  <p>How is it returning more than one column?</p>