title: Adding new column of previous date for account in table
body: <p>Suppose you have a table with snapshots of accounts from the past 4 years, 1 row per date/account pair. (Note accounts don't need to have a row for every day).</p>
  <p>For simplicity suppose there are 3 columns: <code>acct_number</code>, <code>date</code> and <code>balance</code>. How would you add 2 more columns to each row that are the date/balance for that account for the previous date recorded in the table?</p>
  <p>It seems like sorting by <code>acct_number</code> and date then &quot;offsetting by one&quot; and joining to the original table is a promising approach but I don't know how you'd implement this.</p>