|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi genius,
I got the result set as shown below (By executing another query i got this). Month Status Count ===== ====== ===== April I 129 April O 4689 April S 6 July I 131 July O 4838 July S 8 June I 131 June O 4837 June S 8 May I 131 May O 4761 May S 7 But, I need the same result set as below. How to convert like below Month I O S ===== = = = April 129 4689 6 July 131 4838 8 June 131 4837 8 May 131 4761 7 Can anyone provide me the tips/solution. Thanks in advance Regards, j_jst |
|
#2
|
|||
|
|||
|
Hi
Here is my query that i wrote in sqlserver2005 SELECT [Month],[I],[O],[S] FROM ( SELECT [Month] , Status,CountS FROM test ) p PIVOT (max(CountS) FOR [Status] IN ([I],[O],[S]) ) AS pvt ORDER BY [Month] |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Converting Rows into Columns...(Cross Tab) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|