Page 1 of 1

Rows to columns

Posted: Fri Dec 09, 2005 11:39 pm
by sanjeev_sithara
Hi,

How do you achieve the following in a parallel job:

I have a source in the following format

Id Name

----- ---------

1 xx

1 yy

1 zz

2 xx1

2 yy1

2 zz1

3 xx2

3 yy2

3 zz2


I want to get the data in the target as following


id name1 name2 name3

----- -------- ---------- ----------------

1 xx yy zz
2 xx1 yy1 zz1
3 xx2 yy2 zz2

Are there any specific stage to do this.
Any help is highly appreciated.

Thanks

Posted: Fri Dec 09, 2005 11:42 pm
by djm
As your are on unix, if the data is going to have a consistent number of rows each time (e.g. in your example always 3 rows to be turned into 3 columns), the unix "paste" command will achieve this. Try the commnad "man paste" for an explanation.

David.

Posted: Sat Dec 10, 2005 12:06 am
by sanjeev_sithara
Thank You for your reply.The number of rows neednot be consistent.It just turned out to be like that in my example.

Posted: Sat Dec 10, 2005 1:30 am
by kumar_s
Hi,
Pls search for the topic "Vertical Pivot" in the forum

-Kumar

Posted: Sat Dec 10, 2005 1:23 pm
by ameyvaidya
Read up on the Pivot Stage in your Ascential Documentation.

Posted: Sat Dec 10, 2005 1:32 pm
by chulett
That would perform a Horizontal Pivot, basically the exact opposite of what the OP needs to do.

Posted: Sat Dec 10, 2005 6:54 pm
by ameyvaidya
:oops: .

sorry(And Thanks) craig,

Note to self: Do not post just after getting up!!