Merging rows based on the key

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kishorenvkb
Participant
Posts: 54
Joined: Mon Dec 24, 2007 9:27 am

Merging rows based on the key

Post by kishorenvkb »

Hello All,

I have a need to merge the columns based on the key.
There are multiple rows with similar key. The output should have one row for a given key with the values from each row as different columns.
Ex:

1, 1, a, Hello
1, 1, b, Bye
1, 1, c, Now

With first two columns being the key, I wanted the output to be
1, 1, Hello, Bye, Now (a 5 column output)

The data is already pre-partioned and pre-sorted by the key and also just sorted by the third column (column with values a, b, c).

What is the easiest way to accomplish this? For a similar need, I have done a lengthy process below of storing the previous value, comparing that with the new value and making sure that the last records is also written...

Just checking to see if some one has any other creative ideas regarding this.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search DSXchange for "vertical pivot".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply