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 |
|
kshitizgp
Starting Member
31 Posts |
Posted - 2012-02-22 : 02:51:49
|
| declare @col nvarchar(max)select @col = COALESCE(@col + ',','')+ QUOTENAME(Datename(month,work_date ))from form_Details WHERE Work_Date between '2012-01-01' and '2012-03-31'GROUP BY Datename(month,work_date)ORDER BY Datename(month,work_date) ascprint @colWHEN I print@coli get data as march , january , febthe correct order must be jan , feb , march |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-02-22 : 03:43:07
|
| ORDER BY WorkDate--Gail ShawSQL Server MVP |
 |
|
|
|
|
|