Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Order by Month in calandar order

Author  Topic 

Pete_N
Posting Yak Master

181 Posts

Posted - 2012-03-07 : 08:17:23
Select field1, field2, datefield3
from table
Group by Month(datefield3), field1, field2

Order by Month(datefield3)

Datefield3 is a datetime. How can i get the order in month order

ie January , febuary, March etc

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-03-07 : 08:36:56
Your example should work.
Can you post an example for the wrong output?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Pete_N
Posting Yak Master

181 Posts

Posted - 2012-03-07 : 08:58:28
Sorry, all sorted. error in my coding
Go to Top of Page
   

- Advertisement -