Page 1 of 1

Pivoting columns to rows

Posted: Wed Mar 15, 2017 1:04 pm
by anudeepdasari001
Suppose i have a record say


Col1 col2
1 A,B
2 C
3 A,B,D


then i need the output as

Col1 Col2
1 A
1 B
2 C
3 A
3 B
3 D

COuld someone help me please?

Posted: Wed Mar 15, 2017 2:01 pm
by rkashyap
See this post. You can also look at thisone.

Posted: Wed Mar 15, 2017 2:27 pm
by cdp
Or this
Could easily be done using the Pivot Stage.

Posted: Thu Mar 16, 2017 1:56 pm
by rkashyap
Usually yes, but OP's example has variable no of columns to be pivoted!

Posted: Thu Mar 16, 2017 3:25 pm
by chulett
A 'variable' number isn't a problem as long as you know the maximum possible... and that maximum isn't a really big number. :wink: