What I am trying to do is: show updates in a timeline.
The results should show updates from January – December, but at the same time list these months down based on their year.
A visual layout example for this is:
- January 2011
- February 2011
- May 2011
- June 2011
- July 2011
- September 2011
- November 2011
- December 2011
- January 2012
- February 2012
So on and so forth…
As you can see, it came back to January when the year 2011 was done.
What I am having trouble with my query is…
I am only able to order my results this way:
- January 2011
- January 2012
- February 2011
- February 2012
- May 2011
- June 2011
- July 2011
- September 2011
- November 2011
- December 2011
$sql="SELECT * FROM (SELECT * FROM updates ORDER BY year ASC) AS the_id ORDER BY month ASC";
I am not sure how to query this correctly. Some guidance would be greatly appreciated, thanks!
Try this::