Jump to content

[SOLVED] Order by Month/Year not alphabetically.


kevin_newbie

Recommended Posts

Hello,

 

I was doing some research in the query string to order my list of month/years and it only does it alphabetically not by month/year how we view the calendar.

 

For example if I have August 2006, September 2005, December 2006, March 2008, May 2010.

 

The query says

 

select DATE_FORMAT(dates,'%M %Y') as newDates creations where ORDER BY newDates.

 

It orders it like this August 2006, December 2006, March 2008, May 2010, September 2005.

 

I want it to order it like this though; May 2010, March 2008, December 2006, August 2006, September 2005.

 

Is that possible 

It is ordering it alphabetically not by the months like January, February, March, April, May, June, July, August, September, October, November, December.

 

Like with the query up above, it's putting May before March. It's suppose to be March before May. Now do you get what I mean?

ORDER BY dates DESC

 

PFMABiSmAD - I already did that and like I said in the previous post.

 

It is ordering it alphabetically not by the months like January, February, March, April, May, June, July, August, September, October, November, December.

 

Like with the query up above, it's putting May before March. It's suppose to be March before May. Now do you get what I mean?

 

Idougherty - I did make the date column in mysql a datetime field.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.