title: Group by with categories created within the query in SQL
body: <p>I have a table where I want to group by both categories and days, however I want to organize the days into separate buckets and apparently I do not find a way to do it.</p>
  <p>Table:</p>
  <pre><code>| Days       | Category    | Values        |
  |          2 |           A |            20 |
  |          4 |           B |            50 |
  |          6 |           A |           100 |
  |          2 |           A |            70 |
  |          1 |           B |           220 |
  |          9 |           A |           130 |
  |          7 |           A |            45 |
  |          1 |           A |            90 |
  |          5 |           B |           280 |
  |          5 |           B |            10 |
  |          8 |           A |            70 |
  |          9 |           B |            50 |
  |          0 |           A |           120 |
  |          3 |           B |           115 |
  |          0 |           B |            25 |
  |          3 |           B |            10 |
  |          6 |           A |            55 |
  </code></pre>
  <p>The result I would like to get:</p>
  <pre><code>| Days       | Category    | Values        |
  |        0-4 |           A |           300 |
  |        0-4 |           B |           420 |
  |        5-9 |           A |           400 |
  |        5-9 |           B |           340 |
  </code></pre>
  <p>Based on my current knowledge this is how far I can get:</p>
  <pre><code>SELECT
   Days, Category, Value
  FROM
   Table
  GROUP BY
   Days,
   Category
  </code></pre>
  <p>But of course I cannot create the day buckets. Can you please help me out with it?</p>