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 |
khanewal
Starting Member
33 Posts |
Posted - 2010-09-07 : 00:29:25
|
HI Friends,I have this data DocID object1 A1 A2 H3 A1 HRequired outputID C1A C2H Total1 3 1 42 0 1 13 1 0 1Total C1A =4 C2H = 2 C1A+c2h = 6can you please tell me how I can produce this kind of output in SQLHeap Thanks, |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-09-07 : 02:14:25
|
[code]select *from data pivot ( count(object) for object in ([A], [H]) )p[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
khanewal
Starting Member
33 Posts |
Posted - 2010-09-07 : 02:23:28
|
Thanks, I have already done, but not sure how to total A, and H ????????? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-09-07 : 02:27:41
|
[A] + [H] as Total KH[spoiler]Time is always against us[/spoiler] |
 |
|
khanewal
Starting Member
33 Posts |
Posted - 2010-09-07 : 02:56:47
|
Thanks Khtan, its done |
 |
|
|
|
|