i have month table with data type varchar
month1
January
march
December
February
October
September
may
march
i want sql query to arrange month according to month list(jan,feb,march,april)
i have month table with data type varchar
month1
January
march
December
February
October
September
may
march
i want sql query to arrange month according to month list(jan,feb,march,april)
Evening There.
The easiest way to do this is to add a second Field to your table that holds the data for your month number. Your table would look something like this...
MonthID MonthName
1 January
3 March
12 December
2 February
10 October
9 September
5 May
From there, you can run the following statement and it will provide the record in the order of the Month's numerical value, ascending from 1 to 12.
"SELECT MonthName FROM Months ORDER BY MonthID ASC;"
Good Luck.
Scott
thanks i already have answer
ORDER BY
CASE MONTH_FIELD
WHEN 'JANUARY' THEN '1'
WHEN 'FEBRUARY' THEN '2'
...
...
...
END
Another way
[vba]
ORDER BY Month(DateValue(""01-"" & Month_Field))
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber