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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Rows data to Columns(to summarize)

Author  Topic 

jankenshin2004
Starting Member

1 Post

Posted - 2011-07-08 : 05:39:00
I have a problem now on how to make a query which my data look like this


these row data are list of my data on a table
SH 8
LH 8
LHROT 8
LHOT 16
SH 8
LH 8
LHROT 8
LHOT 16


>>>>>>>this should be the output.
SH LH LHROT LHOT
16 16 16 32

the row data is not fix
I will summarize the rows equivalent value on each column..

thnks po


sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-07-08 : 05:44:31
Since you do not know the row values in advance, you will need to use dynamic pivoting. Madhivanan's blog has a function which you can install and use to do this. See here
Go to Top of Page
   

- Advertisement -