Order by month giving reverse order in Mysql -


I'm trying to order a mysql query according to a month name but it is giving the order in reverse order . I have tried both of the ASC and DESC are not working on the order! This is what I am getting:

  order_amount month_number 370.245 December 0.01 August 0.02 July 0.01 May 2 April 3 March 4 February 5 January  

This query Select the amount (amm) in the form of the order: Amount number, month_number orders, where payment = 1 group by month_number month (month_number) ASC

This is a sample table 'order' on which I am running the query

  order_amount month_number 370.245 January 1, 0.01 August 1 0.02 Jul 1st 0.01 Apr 1 May 2 3 3 March 1 February 4 November 0    

< P> month_number () is a harmful name for a string name for the month. He said, your effort will not work, because month () takes a date, does not represent the string, the best way is probably simply case :

< To use pre-> (case when month_number = 'mass' then 1, when month_number =' fur 'then 2. When month_im = = dec' then 12 end)
< P> I strongly suggest that you include a date or actual month number in the table. month_name


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -