January 24, 2012 at 2:49 am
dear all,
I have data in multiple rows like
transid items amount
trans1 item1 100
trans1 item2 50
trans1 item3 75
trans2 item4 25
trans2 item2 50
but I want to data in one rows like:
Transid item1 item2 item3 item4 item5 totalamount gst% transactionamount
trans1 100 50 75 0 0 225 25 250
trans2 0 50 0 25 0 75 15 90
In above row some additional items which customer not purchase but in report I want to show with 0 amount.
I have 6 tables where data come with join.
and one help me What can I do... please reply me as soon as possible.
thanks
January 24, 2012 at 5:33 am
You can solve the problem by using a CROSS TAB or PIVOT
http://www.sqlservercentral.com/articles/T-SQL/63681/ - Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
http://www.sqlservercentral.com/articles/Crosstab/65048/ - Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 24, 2012 at 5:42 am
Thanks dear Kingston Dhasian.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply