title: Calculate average for each day in sql server
body: <p>Hope someone can help me out with the following query as I am not that good in SQL.</p>
  
  <p>I have a SQL table which in which each hour an number of prices for a specific product are stored, day after day. I would like to sum these prices per hour and than calculate the average of these sums over the day. And that for each day in the table.</p>
  
  <p>Table looks something like this (reduced to the appropriate fields):</p>
  
  <pre><code>Date | Time | Price
  01\01\2018 | 00:00 | 100
  01\01\2018 | 00:00 | 100
  01\01\2018 | 00:00 | 120
  01\01\2018 | 01:00 | 150
  01\01\2018 | 01:00 | 150
  01\01\2018 | 01:00 | 90
  01\01\2018 | 02:00 | 100
  01\01\2018 | 02:00 | 105
  01\01\2018 | 02:00 | 98
  ....
  02\01\2018 | 00:00 | 110
  02\01\2018 | 00:00 | 87
  02\01\2018 | 00:00 | 126
  02\01\2018 | 01:00 | 140
  ....
  </code></pre>
  
  <p>So for the example above:</p>
  
  <pre><code>1/1/2018 -&gt; 00:00 -&gt; 320
  1/1/2018 -&gt; 01:00 -&gt; 390
  1/1/2018 -&gt; 02:00 -&gt; 303
  </code></pre>
  
  <p>Average for that day: <strong>337,6</strong>  (and this for each day in the table)</p>
  
  <p>Hope that makes any sense.</p>
  
  <p>Regards,
  Dirk </p>