title: Aggregate function in an SQL update query?
body: <p>I'm trying to set the value in one table to the sum of the values in another table.  Something along these lines:</p>
  
  <pre><code>UPDATE table1
  SET field1 = SUM(table2.field2)
  FROM table1
  INNER JOIN table2 ON table1.field3 = table2.field3
  GROUP BY table1.field3
  </code></pre>
  
  <p>Of course, as this stands, it won't work - <code>SET</code> doesn't support <code>SUM</code> and it doesn't support <code>GROUP BY</code>.  </p>
  
  <p>I should know this, but my mind's drawing a blank.  What am I doing wrong?</p>