I have been grinding my gears on this one. See my previous question on the same topic. It seems as this is a tough one to solve. But, i found this thread, and it seems as Derek Adair has managed to make a json out of the same problem.
My question is:
How can i from this query
SELECT
MONTHNAME(date) as month, YEAR(date) as year
FROM
MOCK_DATA
GROUP BY YEAR(date), MONTH(date) DESC
Get the result either a json array, or obecjt(stdClass)
{
"2009":["August","July","September"],
"2010":["January", "February", "October"]
}
Because now i get the following result:
Array(35) { [0]=> object(stdClass)#19 (2) {
["month"]=> string(8) "December"
["year"]=> string(4) "2013" }
[1]=> object(stdClass)#20 (2) {
["month"]=> string(8) "November"
["year"]=> string(4) "2013" } . . . .
And the expected result is something like:
2013
jan
feb
...etc
2014
jan
feb
..etc
2015
jan
feb
..etc