title: Update using group on Union Incorect Syntax Error
body: <p>I need to use group by inside an update</p>
  
  <pre><code>Update t1 set t1.TemporaryStock = t1.TemporaryStock + isnull(sum(t2.Quantity),0) 
  from inventorymaster t1 join 
  (Select * from InventoryTransTemp Union all Select * from InventoryTrans)t2
  on t1.InventoryItemID=t2.InventoryItemID where t2.TrnDocumentID=169452 
  group by t2.InventoryItemID;
  </code></pre>
  
  <p>I am getting error syntax in group by</p>
  
  <p>If i will use this query with Select instead of update, it works fine
  How can i fix group by error?</p>