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 |
|
kishor86.samant
Starting Member
1 Post |
Posted - 2012-11-08 : 07:48:37
|
| Hi,I have a table like,Officer_Id Data_Point Data_Point_Value1 A bhj1 B dgsdf1 C bdfbhI want to get result like,Officer_Id A B C1 bhj dgsdf bdfbhHow to achieve it? I tried to use Pivot operator in following way,select * from pivot_test tpivot( max(Data_Point_Value) for t.Data_Point in ([A],[B],[C]) ) pvIt works.But while querying i am not aware of all data points (i.e. A, B, C).How to say pivot( max(Data_Point_Value) for t.Data_Point in (*) )Please help.Thanks in advance,Kishor Samant |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-11-08 : 08:28:23
|
| Sounds like you will need to use dynamic pivot. See Madhivanan's blog here - it has code and examples: http://beyondrelational.com/modules/2/blogs/70/posts/10791/dynamic-crosstab-with-multiple-pivot-columns.aspx |
 |
|
|
|
|
|