title: How to write a MySQL query for fetching counts based on time ranges?
body: <p>I have this kind of a table:</p>
  
  <pre><code>userId     loggedtime
  -------------------
  1        2012-03-05 10:45:59
  2        2012-03-05 10:04:19
  2        2012-03-05 10:05:09
  4        2012-03-05 10:20:24
  3        2012-03-05 10:20:20
  6        2012-03-05 10:30:59
  7        2012-03-05 10:35:59
  </code></pre>
  
  <p>I want to select how many users logged in each 5 min interval between 10 o'clock and 11 o'clock. </p>
  
  <p>I need to this kind of a result.</p>
  
  <pre><code>time       count
  ---------------
  10:05        2 
  10:20        2 
  10:30        1 
  10:35        1
  </code></pre>
  
  <p>How do I write the MySQL query for creating this kind of a result?</p>