I am struggling on this issue and was hoping if anyone out there can
help me.
Here is the setup: I have a table with the following data:
TableName: TranDetail
MerchID ItemName Price
------------------
101 A 5
101 B 3.5
101 C 0
102 B 7.6
102 C 4
102 E 65
102 G 4
103 K 35
Table Design
MerchID int
ItemName varchar(50)
Price float
What I would like is a report that looks like this
MerchID A B C E G K
101 5 3.5 0
102 7.6 4 65 4
103 35
This report can change on every run depending on data in table
TranDetail. The column name in report depends on ItemName in table
TranDetail. As seen in the above report, there is no data for Items D,
F, H, I, J and hence they do not show up in the report.
What I need: Code for a stored procedure that can get me this data.
Thanks for your help...
DBA in despair!