Hi,
I need to retrieve data from MySQL tables and to retrieve as follows:
['Years', 'January', 'February', 'March','April','May', 'June','July', 'August', 'September','October','November','December',{ role: 'annotation' }],
['2012', 10, 24, 20, 32, 18, 5,10, 24, 20, 32, 18, 5,'2012']'
['2013', 0, 22, 23, 30, 0, 9,0, 22, 23, 30, 0, 9,'2013'],
['2014', 10, 24, 20, 32, 18, 5,10, 24, 20, 32, 18, 5,'2014'],
['2015', 0, 22, 23, 30, 0, 9,0, 22, 23, 30, 0, 9,'2015'],
['2016', 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0, 0,'2016'],
['2017', 16, 22, 23, 30, 0, 9,0, 22, 23, 30, 0, 9,'2017'],
['2018', 10, 24, 20, 32, 18, 5,10, 24, 20, 32, 18, 5,'2018'],
['2019', 0, 22, 23, 30, 0, 9,0, 22, 23, 30, 0, 9,'2019'],
['2020', 28, 19, 29, 30, 12, 13,28, 19, 29, 30, 12, 13,'2020']
To display values in Google chart(
https://i.imgur.com/n1grcto.png).
I am having two tables "user" and "usertypes", in user table there is only one date column which stores the date of joining(say 2020-05-12). I want to retrieve the data for the current year(say 2020).
My output needs to be:
|Year|jan|feb|mar|..|may|..|dec|
|2020| 0 | 0 | 0 |..|1|....| 0 |
|2019| 5 | 0 | 4 |..|0|....| 2 |
|2018| 0 |12 |44 |..|0|....| 0 |
...
|2012| 0 | 4 | 1 |..|0|....| 5 |
So that I able to frame the structure what the Google chart is expecting for Stacked column chart.
Kindly suggest me ideas.
Thank You in advance.
What I have tried:
I didn't try as much but I query with error or cannot frame the structure.