I am trying to create a histogram data using following query:
SELECT FLOOR(Max_Irrad/10) AS bucket, COUNT(*) AS COUNT
FROM marctest.test_summarynimish
where Lcu_name='Allegro'
and Lcu_Mode='Standard'
GROUP BY bucket;
following is the result that i am getting:
bucket count
0 3
4 3
5 12
7 6
8 3
10 3
now the bucket field is the range or bin used in the histogram. I want to create a bucket values with consistent range, for eg starting from 0,4,8,12.... and so on.. Is there any way to achieve this in mysql? This is how I am expecting to have as result:
bucket count
0 3
4 21
8 6