Hi I am trying to use pivot and am not getting the desired output, i searched the forum but none helped
Here is my input
Col1, Col2
--------------
a,1
a,2
a,3
a,4
b,1
b,5
b,6
And the output I want is
Col
-----
a
1
2
3
4
b
1
5
6
By using pivot I am getting
a
1
a
2
a
3
a
4
b
1
b
5
b
6
Please help!!!
trouble with pivot
Moderators: chulett, rschirm, roy
That's not really a pivot. You could "pre-process" the data into a form that the pivot stage would like however, I would assume. Or perhaps do this all with stage variables in the transformer.
I'm short on time (and brains atm) so will leave the gory details to others...
I'm short on time (and brains atm) so will leave the gory details to others...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 64
- Joined: Tue Sep 23, 2008 9:54 am
If you set the option Create Key Change column in sort to true then sort creates a column keyChange and output of sort isa,1
a,2
a,3
a,4
b,1
b,5
b,6
If keyChange is one then add a newline char between Col1 and Col2 else just Col2a,1,1
a,2,0
a,3,0
a,4,0
b,1,1
b,5,0
b,6,0
Code: Select all
If keyChange=1 then Col1 : char(10): Col2 Else Col2
You are the creator of your destiny - Swami Vivekananda