title: Get average of last 7 days
body: <p>I'm attacking a problem, where I have a value for a a range of dates. I would like to consolidate the rows in my table by averaging them and reassigning the date column to be relative to the last 7 days. My SQL experience is lacking and could use some help. Thanks for giving this a look!!</p>
  
  <p>E.g.
  7 rows with dates and values.
  </p>
  
  <pre><code>UniqueId    Date      Value
  ........    ....     .....
    a       2014-03-20   2
    a       2014-03-21   2
    a       2014-03-22   3
    a       2014-03-23   5
    a       2014-03-24   1
    a       2014-03-25   0
    a       2014-03-26   1
  </code></pre>
  
  <p>Resulting row
  </p>
  
  <pre><code>UniqueId    Date      AvgValue
  ........    ....      ........
    a       2014-03-26   2
  </code></pre>
  
  
  
  <p>First off I am not even sure this is possible. I'm am trying to attack a problem with this data at hand. I thought maybe using a framing window with a partition to roll the dates into one date with the averaged result, but am not exactly sure how to say that in SQL. </p>