title: Adding computed column in SQL
body: <p>How to add computed column that calculates the sum of selected column.</p>
  
  <p>this is what i've done but has an error..</p>
  
  <pre><code>ALTER TABLE dbo.tblEM_Reimbursement
  ADD [Amount] AS (SELECT SUM(Total) FROM dbo.tblEM_ReimbursementEntry WHERE ReimbursementID = ReimbursementID)
  </code></pre>
  
  <p>it says</p>
  
  <blockquote>
    <p>Msg 1046, Level 15, State 1, Line 2<br>
    Subqueries are not allowed in this context. Only scalar expressions are allowed.</p>
  </blockquote>
  
  <p>Thanks in advance</p>