Wednesday, March 7, 2012

Challenge : Vertical view to Horizontal in a StorProc

From:
Cust | Qstion | Answer
_________________________________
1,1,Bike
1,4,Blue
1,6,No ensurance
2,1,Car
2,3,silver
2,9,ensurance
2,11,Yes

To the following
Cust______1______3______4______6______9______11
__________________________________________________ __________
1_______Bike___________Blue__No ENsur_________
2_______car____silver_________________Ens____Yes"That's no challenge, it is a pivot.

-PatP|||That's no challenge, it is a pivot.

-PatP

Its not a pivot because a pivot will have a count or a sum function in it this dosn't|||Its not a pivot because a pivot will have a count or a sum function in itWhy? I pivot data all the time, and only aggregate it about 20% of the time. Usually I just want the rows presented as columns and vice versa... I don't care about aggregation.

-PatP|||You can fake-out the aggregation by using MAX([Answer]). Since there is only one answer for each Cust and Question, that is what you will get.|||So obvius that i overlooked it compleetly

Thanks again
Hope the stress level will drop as quiick as it raise

No comments:

Post a Comment