January 20, 201312 yr I would like to order my results by name of month. If CHARINDEX was an option, this would be nice: ORDER BY CHARINDEX(LEFT(month_name, 3) , 'JAN', 'FEB', 'MAR', 'APR,' 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC') Here are my results for a google chart I am potting, I just need the proper order. ['Apr', 8], ['Aug', 7], ['Feb', 42], ['Jan', 30], ['Jul', 39], ['Jun', 26], ['Mar', 36], ['May', 31], ['Nov', 36], ['Oct', 17], ['Sep', 40]
January 20, 201312 yr I am not aware that you can orderby with custom sorting, but you could use a custom function to sort the result after the sql query. E.g. this one: http://www.briandunning.com/cf/593
January 20, 201312 yr Author Thanks Claus, processing the query with substitue did the trick, after I switch the query to return the month number instead of month name.
January 20, 201312 yr Thanks Claus, processing the query with substitue did the trick, after I switch the query to return the month number instead of month name. If the data you are selecting from contains both month name and number, can't you sort by month name, but select month number?
Create an account or sign in to comment