title: MySQL Average temperature specifying number of days
body: <p>I have a table called data with columns:</p>
  
  <ul>
  <li>date [timestamp]</li>
  <li>temperature [int(11)]</li>
  <li>humidity [int(11)]</li>
  </ul>
  
  <p>(for example ... date: 2016-06-11 10:07:22, temperature: 22, humidity: 50)</p>
  
  <p>I get a new entry every 60 seconds.</p>
  
  <p>Im wondering if its possible to define a query that will return the average temperature and humidity of every hour for a specified number of days. I need the hour average for yesterday (1 day), last week (last 7 days) and last month (last 30 days).</p>