December 12, 2017 at 12:51 pm
Hi there,
Is it possible to create a pivot table from more than one fields?
[customer sale_period product_category amount
[sale_period] is a known value such as 3, 6, 9, 12/code]
What I try to achieve is
[[customer] [sale_period3 + product_category1] [sale_period3 + product_category1] [amount]/code]
So in other words, the pivot table would become quite 'wide' since every combination of the known contents of [sale_period] and [product_category] would become a column.
Thanks for any help 🙂
December 14, 2017 at 1:23 pm
Please post a create table script, inserts with sample data, what you've tried, any errors and expected output based on sample data provided.
December 14, 2017 at 1:30 pm
Sure, you can read the following article to know the best way to do it.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - SQLServerCentral
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply