title: How to count number of messages per half hour?
body: <p>Consider the following table:</p>
  
  <pre><code>msg_id  _time
  -------------
  1       13:32
  2       13:56
  3       14:05
  4       15:00
  5       15:17
  6       15:28
  7       16:40
  </code></pre>
  
  <p>I'm currently aggregating the number of messages per hour, as follows:</p>
  
  <pre><code>SELECT HOUR(_time) AS hour, COUNT(msg_id) AS cnt FROM messages GROUP BY hour 
  ORDER BY hour
  </code></pre>
  
  <p>This results in a resultset as follows:</p>
  
  <pre><code>hour  cnt
  ---------
  13    2
  14    1
  15    3
  16    1
  </code></pre>
  
  <p>What I want, however, is the count per <strong>half</strong> hour:</p>
  
  <pre><code>hour   cnt
  ----------
  13:30  2
  14:00  1
  14:30  0
  15:00  3
  15:30  0
  16:00  0
  16:30  1
  </code></pre>
  
  <p>What is the query making this possible? If necessary, I guess I could mkae a table with the half-hour times (00:00, 00:30, 01:00, 01:30, ... 23:00, 23:30), but prefer not too. (And I still wouldn't know how to use that table either).</p>
  
  <p>Any help is greatly appreciated :-)</p>