Connecting Tech Pros Worldwide Forums | Help | Site Map

Pivot and concatenate

Uncle Dickie's Avatar
Member
 
Join Date: Nov 2008
Posts: 47
#1: Nov 6 '08
Sorry, another pivot type problem from me! In this instance I have a table showing parts and shortages:

PartNo, Component Shortage
PART1, ResA
PART1, ResB
PART2, CapA
PART2, CapB
PART2, ResA

What I want to end up with is a single 'shortages' column against a part:

PartNo, Shortages
PART1, ResA + ResB
PART2, CapA + CapB + ResA

Is this possible and if so any pointers?
Many thanks,

Richard

ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Nov 6 '08

re: Pivot and concatenate


You can use the technique I discussed in my blog. Read more about it here

Happy Coding!


-- CK
Uncle Dickie's Avatar
Member
 
Join Date: Nov 2008
Posts: 47
#3: Nov 6 '08

re: Pivot and concatenate


Thanks CK,
I can see how that works if I want all entries in the second column as one string, but I need it to group it by the first column. I can't see a way of changing your code to do this.
Uncle Dickie's Avatar
Member
 
Join Date: Nov 2008
Posts: 47
#4: Nov 6 '08

re: Pivot and concatenate


I may have found a solution here

It looks to be working so far but I have more playing to do! This is the first time I have ventured into functions!
Reply