i have a table where i am storing all the months where its in varchar january,december,march,july,june, etc
i want mysl qurey to order by month
ex
january
febuary,
march
kindly guide me in doing the same
i have a table where i am storing all the months where its in varchar january,december,march,july,june, etc
i want mysl qurey to order by month
ex
january
febuary,
march
kindly guide me in doing the same
Change the column with the months, (which is now a varchar) into a date column.
Let's take for example a 3 column table, colum3 is your month column, then your query would be
[vba]SELECT column1, column2, MONTHNAME(column3)
FROM TABLE
ORDER BY column3[/vba]
i have used this query
[VBA]
SELECT *,
(CASE
WHEN month= 'January' THEN 0
WHEN month= 'Febuary' THEN 1
WHEN month= 'march' THEN 2
END) as rank
FROM text ORDER BY rank
[/VBA]