I think we can use the following general form to create a general histogram:
select (x div 4) * 4 as NewX, count(*) as NewY from histogram group by NewX
Where x is the true x-axis value of x, and count(*) is the actual y-value. The number 4 is the size of the quantity x that we want to group. This means that we will group all the x values ββin groups of 4 (for example: group 1 is 0, 1, 2, 3, group 2 is 4, 5, 6, 7, etc.). The amount of each item in the group will become NewY
You can play with it here
Applying this logic to your query, it will be:
select (floor(Max_Irrad/10) div 4) * 4 as NewX, count(*) as NewY from marctest.test_summarynimish where Lcu_name='Allegro' and Lcu_Mode='Standard' group by NewX
Let me know if you have any problems or doubts about this.
Mosty mostacho
source share