title: SQL moving average
body: <p>How do you create a moving average in SQL?</p>
  
  <p>Current table:</p>
  
  <pre><code>Date             Clicks 
  2012-05-01       2,230
  2012-05-02       3,150
  2012-05-03       5,520
  2012-05-04       1,330
  2012-05-05       2,260
  2012-05-06       3,540
  2012-05-07       2,330
  </code></pre>
  
  <p>Desired table or output:</p>
  
  <pre><code>Date             Clicks    3 day Moving Average
  2012-05-01       2,230
  2012-05-02       3,150
  2012-05-03       5,520          4,360
  2012-05-04       1,330          3,330
  2012-05-05       2,260          3,120
  2012-05-06       3,540          3,320
  2012-05-07       2,330          3,010
  </code></pre>