title: (SQL) SELECT the average value with interval
body: <p>Sample data:</p>
  
  <p><a href="https://i.stack.imgur.com/Vv11C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vv11C.png" alt="enter image description here"></a></p>
  
  <p>I want to select the average value every 5 minutes, for example.</p>
  
  <p>The result should be a list like this:</p>
  
  <pre><code>3
  8
  </code></pre>
  
  <p>The functions for this should be: <code>AVG(VALUE), DATEDIFF(datepart, startdate, enddate) with datepart=minute and/or DATEADD (datepart, number, date)</code></p>
  
  <p>I didn't find an interval function (Transact-SQL)</p>
  
  <p><strong>Update</strong></p>
  
  <p>Example of what I really want to do here:</p>
  
  <p><a href="https://i.stack.imgur.com/XCAYF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XCAYF.png" alt="sample"></a></p>
  
  <p>I want the average values between points to plot a trendline I have to change the "cluster" means the resolution to calculate it. In this example my cluster is 1. 2 would mean, that I'll get the average from the first 3 value points. I hope i did explained it well!</p>