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
 Development Tools
 ASP.NET
 dynamic sql

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2008-02-27 : 06:52:33

columns of table as
productcode actual, plan, marketcode
P1 A1 Pl1 M1
P1 A2 Pl2 M2
p2 A3 Pl3 M3

I want productwise output as

Row1-> P1 Sum(A1) productcodewise Sum(PL1) productcodewise M1 Sum(A2) productcodewise Sum(PL2) productcodewise M2
Row2-> P2 Sum(A3) productcodewise Sum(PL3) productcodewise M3 ..0 for remaining columns

How wil get output as above

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-27 : 07:16:05
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-27 : 07:27:07
Read about Cross-tab reports in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -