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.
| Author |
Topic |
|
zara_chd
Starting Member
7 Posts |
Posted - 2011-10-04 : 12:37:17
|
| Hi all,Is there any way I can order month names monthwise,I have used MonthName function to get the names of the month. But all month names are coming in alphabatical order. I want all month names in monthwise e.g. dec,jan feb,march april etc.Please some one help meThanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-04 : 12:39:20
|
| ORDER BY DATEPART(mm,DateField)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-10-05 : 01:02:13
|
SELECT DATENAME(MONTH, Col1), SUM(Col2)FROM dbo.Table1GROUP BY DATENAME(MONTH, Col1), DATEPART(MONTH, Col1)ORDER BY DATEPART(MONTH, Col1) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
zara_chd
Starting Member
7 Posts |
Posted - 2011-10-05 : 07:18:52
|
quote: Originally posted by visakh16 ORDER BY DATEPART(mm,DateField)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Thankssss, it worked |
 |
|
|
zara_chd
Starting Member
7 Posts |
Posted - 2011-10-05 : 07:19:26
|
quote: Originally posted by SwePeso SELECT DATENAME(MONTH, Col1), SUM(Col2)FROM dbo.Table1GROUP BY DATENAME(MONTH, Col1), DATEPART(MONTH, Col1)ORDER BY DATEPART(MONTH, Col1) THANKS DEAR N 56°04'39.26"E 12°55'05.63"
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-05 : 07:39:19
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|