Something like this might do the trick.
Something like this:
select Month_Name,
case Month_Name
when 'January' then 1
when 'February' then 2
when 'March' then 3
... etc ...
else 13
end as Month_Order
from Your_Table
where Something = Something
order by Month_Order
Ray Thompson
Tau Beta Pi (www.tbp.org)
The Engineering Honor Society
865-546-4578
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 12, 2007 12:05 PM
To: SQL
Subject: RE: Sort by month
Don't know how to do that. Can you give an example?
-----Original Message-----
From: Daniel Farmer [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 12, 2007 11:29 AM
To: SQL
Subject: RE: Sort by month
Why not just write your own function to return a proper date object
based on the string of date you pass in?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 12 July 2007 15:57
To: SQL
Subject: RE: Sort by month
Tried this, but since it is not stored as a date but varchar, datepart
will not work.
-----Original Message-----
From: Mike Hughes [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 12, 2007 10:40 AM
To: SQL
Subject: Re: Sort by month
Try
In Selectstaement add
DATEPART(dd, Birthdate) AS DayOfBirth";
OrderByStatement = "ORDER BY DayOfBirth"
On 7/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have a table with the month stored as January, February,
> March.....etc. How do I write a query to order by month so that
> January is first, Feb second and so on? I'm using SQL server and
ColdFusion.
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS
Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2872
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6