title: mysql - how to count number of records in an hour (datetime) using sql
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10110341/group-records-by-time">Group records by time</a>  </p>
  </blockquote>
  
  
  
  <p>I have a mysql table that logs web page requests.</p>
  
  <p>I'd like to write a sql that outputs the number of requets per hour.</p>
  
  <pre><code>INPUT:
  timestamp              browser
  -------------------    -------
  2012-06-28 15:06:14    chrome
  2012-06-28 15:12:15    IE6
  2012-06-28 16:32:16    IE7
  
  OUTPUT:
  timestamp              count
  -------------------    -------
  2012-06-28 15:00:00    2
  2012-06-28 16:00:00    1
  </code></pre>
  
  <p>I'm guessing my first step would be to 'truncate' the datetime field so that I can do a group-by.  Searching, I have found some examples of rounding the hour, but none to truncate.   </p>