title: Adding a derived column on an existing table
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11908456/derived-calculated-column-on-existing-table">Derived/calculated column on existing table</a>  </p>
  </blockquote>
  
  
  
  <p>I have SQL Server table with values, as follows:</p>
  
  <pre><code>Account - Date - Amount - Summary
  10000 - 2010-1-1 - 50.00 - 0.00
  10000 - 2010-2-1 - 50.00 - 0.00
  10000 - 2010-3-1 - 50.00 - 0.00
  10000 - 2010-4-1 - 50.00 - 0.00
  10000 - 2010-5-1 - 50.00 - 0.00
  10000 - 2010-6-1 - 50.00 - 0.00
  10000 - 2010-7-1 - 50.00 - 0.00
  10000 - 2010-8-1 - 50.00 - 0.00
  10000 - 2010-9-1 - 50.00 - 0.00
  10000 - 2010-10-1 - 50.00 - 0.00
  10000 - 2010-11-1 - 50.00 - 0.00
  10000 - 2010-12-1 - 50.00 - 600.00
  10001 - 2010-1-1 - 50.00 - 0.00
  10001 - 2010-2-1 - 60.00 - 0.00
  10001 - 2010-12-1 - 60.00 - 170.00
  </code></pre>
  
  <p>This is a basic snapshot of the table. The "summary" field gives the total for the amounts at the end of the year on the date column, but only when the MONTH(Date) = '12'. It goes on this way for hundreds of accounts, with about 4 more years as well. I would like to add a column to this existing table, called "SummaryPreviousYear". The SummaryPreviousYear column should have the sum of the amounts from MONTH(Date) = '12' and the previous year. I'd like to join this column on the account number, so that it sits next to the Summary column and gives a value just like the Summary value does. Can anyone help me with this? I am pulling my hair out here. Any help would be greatly appreciated.</p>