The below SQL (mySQl database) reads data and produces the last 12 months which I use for a graph. This seems fine, but I would like the data in a different order top - oldest month, to bottom latest month, instead of below. Is there a way I can achieve this in one hit with SQL or do I have to resort to additional XOJO manipulation to achieve what I need?
SELECT
DATE_FORMAT(Entered, '%b') AS MONTH,
SUM(Time_Minutes) AS total
FROM
reptime
WHERE
Entered <= NOW()
AND Entered >= Date_add(Now(), INTERVAL - 11 MONTH)
AND Own_Time = '0'
GROUP BY
DATE_FORMAT(Entered, '%m-%Y')
Output produced is:
Jan 3479
Feb 4331
Mar 3460
Apr 6214
May 975
Jun 4332
Jul 3000
Aug 6415
Sep 6961
Oct 13401
Nov 6033
Dec 4159
The months before Jan are 2016, those after, 2017 and I would like order (as we are in May 17) below. The figures are correct for each month so I know I have the right numbers, just the wrong order.
Jun 16
Jul 16
Aug 16
Sep 16
Oct 16
Nov 16
Dec 16
Jan 17
Feb 17
Mar 17
Apr 17
May 17
Is there an ‘order by’ I could add that would achieve this?