Tame this format with a cross tab ?
Posted
by
Damien Joe
on Stack Overflow
See other posts from Stack Overflow
or by Damien Joe
Published on 2010-12-21T05:51:59Z
Indexed on
2010/12/21
5:54 UTC
Read the original article
Hit count: 341
I have result of query in form
EmpId Profit OrderID CompanyName
------ ------ ------- --------------
1 500 $ 1 Acme Company
1 200 $ 1 Evolve Corp.
2 400 $ 1 Acme Company
2 100 $ 1 Evolve Corp.
3 500 $ 1 Acme Company
3 500 $ 1 Evolve Corp.
Now the desired report format is
EmpId OrderId Acme's Profit Evolve's Profit
----- ------ ------------- ---------------
1 1 700 $ 700 $
2 1 500 $ 500 $
3 3 1000 $ 1000 $
I tried hard at the crosstab but I'm unable to figure out how to group the records. I tried moving CompanyName in CrossTab columns and moved EmpId in rows & tried a cross tab group but results are not as expected.
My questions are 1) Is this format achievable with a cross tab ? 2) How do I group record's by EmpId's in my crosstab in such a way that the Companies are moved horizontally ?
© Stack Overflow or respective owner