how to do this right

Select DATE_FORMAT(EventDate, '%b %d, %Y') from details Order by STR_TO_DATE(EventDate, '%d-%m-%y')





Oct 24, 2012
Oct 27, 2012
Oct 28, 2012
Oct 20, 2012
Dec 22, 2012    
Jan 11, 2013    
Jan 19, 2013
Nov 24, 2012
Dec 29, 2012

What do the values of EventDate look like before you do STR_TO_DATE()? Maybe you can post the output of Select EventDate, DATE_FORMAT(EventDate, '%b %d, %Y') from details Order by STR_TO_DATE(EventDate, '%d-%m-%y') so that we can see the real value and the computed value side-by-side.

Just an aside, but do you really mean to sort EventDate by day, then month, then year? Typically it would be by year, then month, then day if you want them in chronological order.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.