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 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.