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 |
|
ranalk
Starting Member
49 Posts |
Posted - 2010-02-21 : 09:25:24
|
Hi,I need (desperately) to change a SQL result from Horizontal view to vertical.the current table looks like this: However, i would like it to be three columns (Subject, API_Live, Live).The subject column will have all the titles (UpdatePlayerBalance,GetPlayerBalance etc.).Thanks a lot. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-21 : 09:31:26
|
| [code]SELECT Subject,API_LIVE,LIVEFROM(SELECT EnvironmentDescription,Subject,ValueFROM Table tUNPIVOT (Value FOR Subject IN ([UpdatePlayerBalance],[GetPlayerBalance],...,[Timeouts]))u)mPIVOT (SUM(Value) FOR EnvironmentDescription IN ([API_LIVE],[LIVE]))p[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
ranalk
Starting Member
49 Posts |
Posted - 2010-02-21 : 10:23:12
|
| Thanks a lot visakh !It works perfectly.Besides, your blog is nice.Thanks again. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-21 : 10:25:50
|
quote: Originally posted by ranalk Thanks a lot visakh !It works perfectly.Besides, your blog is nice.Thanks again.
Welcome Thanks ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|