title: Is it possible to update a pair of values in TSQL from a subquery?
body: <p>Can I update a pair of columns using the same subquery instead of calling it twice?</p>
  <pre class="lang-sql prettyprint-override"><code>-- Table D contains a Date and a ProcessId
  
  UPDATE T1
  SET (Val1, Val2) = (
      SELECT SUM(Val1A), SUM(Val2A) 
      --Val1A and Val2A are equations and are not taken from just one table but multiple
      FROM D
        INNER JOIN T8 ON T8.ProcessId = D.ProcessId
        INNER JOIN T4 ON T4.Id = T8.T4Id
        INNER JOIN T6 ON T4.Id = T6.T4Id
      WHERE D.Date &lt;= @ProcessDate AND T6.T4Id = T1.T4Id)
  FROM T1
    INNER JOIN T4 ON T4.Id = T1.T4Id
    INNER JOIN T5 ON T5.Id = T1.T5Id
    INNER JOIN T6 ON T4.Id = T6.T4Id
    INNER JOIN T7 ON T7.Id = T4.T7Id
  </code></pre>
  <p>Instead of doing</p>
  <pre class="lang-sql prettyprint-override"><code>UPDATE T1
  SET Val1 = (SELECT Val1A
       FROM T2 
         INNER JOIN T8 ON T8.T2Id = T2.Id
         INNER JOIN T4 ON T4.Id = T8.T4Id
         INNER JOIN T6 ON T4.Id = T6.T4Id
       WHERE T4.T1Id = T1.Id)
      Val2 = (SELECT Val2A
       FROM T2 
         INNER JOIN T8 ON T8.T2Id = T2.Id
         INNER JOIN T4 ON T4.Id = T8.T4Id
         INNER JOIN T6 ON T4.Id = T6.T4Id
       WHERE T4.T1Id = T1.Id)
  FROM T1
    INNER JOIN T4 ON T4.Id = T1.T4Id
    INNER JOIN T5 ON T5.Id = T1.T5Id
    INNER JOIN T6 ON T4.Id = T6.T4Id
    INNER JOIN T7 ON T7.Id = T4.T7Id
  </code></pre>
  <p>Note: The FROM and WHERE clauses are obviously more complex than this</p>