title: Subtracting values based on date SQL
body: <p>I have data that looks like this but with many more index names and index values</p>
  
  <pre><code>dt                     indx_nm      indx_val
  2013-08-13 00:00:00.000 ABQI        1571.93
  2013-08-12 00:00:00.000 ABQI        1568.55
  2013-08-09 00:00:00.000 ABQI        1566.1
  2013-08-08 00:00:00.000 ABQI        1573.98
  2013-08-07 00:00:00.000 ABQI        1567.42
  2013-08-06 00:00:00.000 ABQI        1579.49
  2013-08-13 00:00:00.000 ACNACTR     280.3931
  2013-08-12 00:00:00.000 ACNACTR     275.1943
  2013-08-09 00:00:00.000 ACNACTR     268.8868
  2013-08-08 00:00:00.000 ACNACTR     265.7915
  2013-08-07 00:00:00.000 ACNACTR     264.8321
  2013-08-13 00:00:00.000 ACNITTR     145.3845
  2013-08-12 00:00:00.000 ACNITTR     144.1252
  2013-08-09 00:00:00.000 ACNITTR     143.2331
  2013-08-08 00:00:00.000 ACNITTR     141.4968
  2013-08-07 00:00:00.000 ACNITTR     140.6079
  </code></pre>
  
  <p>How could I write a SQL query in order to subtract the indx_val by the indx_val of the previous date for all dates. I would like to find daily returns essentially. For example for <code>ABQI</code> it would be <code>1571.93</code> - <code>1568.55</code> as the return for the date <code>2012-08-13</code> and so forth. I would like for the result to have a <code>dt</code> column, <code>indx_nm</code> column, and <code>dly_rtn</code> column. Thank you!</p>