title: Time slots using Case in MySql
body: <p>I'm trying to sum on fields by 3 time slots with this code:</p>
  
  <pre><code>SELECT 
  CASE when TIME(v.time) between cast('00:00:00' as time) and cast('06:00:00' as time) then '00:00:00 - 06:00:00'
  when TIME(v.time) between cast('06:00:00' as time) and cast('16:00:00' as time) then '06:00:00 - 16:00:00'
  when TIME(v.time) between cast('16:00:00' as time) and cast('00:00:00' as time) then '16:00:00 - 00:00:00' End as 'TimeSlot',
  sum(v.resting)
  FROM vital_activity_histogram v
  GROUP BY 'TimeSlot'
  </code></pre>
  
  <p>The result I want is(for example):</p>
  
  <pre><code>time slot              | Sum(v.resting)
  00:00:00 - 06:00:00        24
  06:00:00 - 16:00:00        56
  16:00:00 - 00:00:00        72
  </code></pre>
  
  <p>what I get when I run the query is:</p>
  
  <pre><code>time slot              | Sum(v.resting)
  00:00:00 - 06:00:00        24
  </code></pre>
  
  <p>And I have data inside the other time slots.
  Anyone know how to fix this?
  Thanks!!</p>