Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Can i do this (pivot) Expand / Collapse
Author
Message
Posted Tuesday, February 11, 2014 1:13 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 17, 2014 2:33 AM
Points: 47, Visits: 314
Im not even sure this is possible.

I have a data set that is pulled into a excel spread sheet and pivoted as below.




orders and values are group along the top for currency (GBP), Code (E), Group (Austin), Year(2010), Month (10) and split by sales date (row labels). obviously there are many different groups, codes, year, month which stretch along the top.

im wanting to replicate this into a staging table, is this possible. i looked at pivot but it only seems to work with one grouping?

all help appreciated
Post #1540423
Posted Tuesday, February 11, 2014 1:20 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:39 PM
Points: 2,763, Visits: 5,913
It's possible, take a look at this articles:
Cross Tabs: Part 1
Cross Tabs: Part 2



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1540426
Posted Tuesday, February 11, 2014 2:51 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, April 17, 2014 2:33 AM
Points: 47, Visits: 314
i had a look, im not sure if this will give me the ability to dybamicaly build the column groupings. or am i missing somthing - possible
Post #1540459
Posted Tuesday, February 11, 2014 4:20 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 6:39 PM
Points: 2,763, Visits: 5,913
I'm not sure what you need without DDL, sample data and expected results.
However, those articles have the basic theory to pivot queries both static and dynamic.

For more help, please read the article linked on my signature.



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1540488
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse