Page 1 of 1

joining datasets

Posted: Wed Jun 15, 2005 3:43 am
by kcshankar
Hi,

I have two datasets with same no.of columns and rows.
I want to join these datasets and the output dataset should have same num of rows.
Is there any method apart from lookup.

Table 1
A B
1 2
1 4

Table 2
A C
1 3
1 5

and I want the output like

A B C
1 2 3
1 4 5


Thanks in advance
kcs

Posted: Wed Jun 15, 2005 4:14 am
by Prashantoncyber
hi,

you can append a dummy colum in each table using transferformer to create data like this

Table 1

A B Dummy Column
1 2 X
1 4 X


Table 2

A C Dummy Column
1 2 X
1 4 X

now use join Stage subsequently to get the desired result using Dummy
column as key.

Thanks
Prashant

Posted: Wed Jun 15, 2005 4:14 am
by roy
Hi,
look at the join,merge stages
I think you will find that a lookup is probably the fastest way.

IHTH,

Posted: Wed Jun 15, 2005 4:31 am
by kcshankar
Hi Prashant & Roy,
thanks for your reply.

Prashant, Column A is a dummy column in my job and I tried using that but iam getting duplicate rows.
I want output dataset of same num of rows as of source(ie both my source file have 1000 rows, i want the resulting file of 1000 rows).



Thanks in advance

kcs

Posted: Wed Jun 15, 2005 5:07 am
by Sainath.Srinivasan
When you write in a dataset, the rows will not be organized as it was in the source. Hence you may lose the order.

But if this is ok, you can use stage variables to write sequential numbers and then join on that.

Posted: Wed Jun 15, 2005 6:03 am
by kcshankar
Hi Sai,
Thanks for your reply. :D

I got the solution.

I used column generator to create dummy column with sequence,then I use Join stage to get the required output.

Table 1
A B
aa 2
bb 4

Table 2
A C
aa 3
bb 5

Output Table
A B C
aa 2 3
bb 4 5



Thanks Sai
kcs