title: MS SQL 2008 - update record with a value if the grouped total meets a condition
body: <p>I am trying to figure out how to update record with a value only in case that the grouped total of a particular type of transactions type is over zero.
  In other words, I group my transactions by payment type. If the grouped payment type total is greater than zero, I would like to update each of the transaction in the group with a value.
  I cannot figure out that correct statement. Could anyone help please?</p>
  
  <pre><code>UPDATE
      T
  SET
      T.col1 = OT.col1,
      T.col2 = OT.col2
  FROM
      Some_Table T
  INNER JOIN
      Other_Table OT ON T.id = OT.id
  WHERE
      T.col3 = 'xyz'
  -- GROUP BY T.col1
  -- HAVING SUM(amount) &gt; 0
  </code></pre>