Merge two different columns

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Merge two different columns

Post by devanars »

I need to merge two different columns. those two columns are coming from two different tables. there are no such options like join or match or any keys to them. two columns are entirly different columns. have to take two stages for two columns of two source tables,need to get those two columns in target table. what was the processing stage i can use for this or is there any other way to get.

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... what are your join or merge rules for this? In other words, how do you know which record from one table needs to be joined/merged with what row from the other table? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

I need to get both columns A and B are in the target. Column A is coming from one table,Column B is coming from from different table. Column A is coming by executing a lengthy sql. i have taken Column A in one source stage and Columb B is with one more source stage. eventually i need to populate Column A and B in the same target with one process/job only.
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

If column A is having 10 rows and column B is having 5 rows ...how many rows should be in output ? on what basis you what to concatenate A and B .You want cross join ??
Nag
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

In your case i need all 15 records. Yes it might be Cross Join. can you please explain how can i do that. Appreciate your help.

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

devanars wrote:I need to get both columns A and B are in the target. Column A is coming from one table,Column B is coming from from different table. Column A is coming by executing a lengthy sql. i have taken Column A in one source stage and Columb B is with one more source stage. eventually i need to populate Column A and B in the same target with one process/job only.
This is your original post restated and does not answer my question at all. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

There are no such rules, just selecting from two different sources and have to populate in the output there after we have to process...

Sorry about that. I might not able to explain in a proper way.

Thanks
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

For a cross join you will get 50 rows not 15 rows ...i didnt understand your exact requirement ...provide an example to make things clear..
devanars wrote:In your case i need all 15 records. Yes it might be Cross Join. can you please explain how can i do that. Appreciate your help.

Thanks
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You must have a rule. :?

OK, failing that - as noted, give us an exmple. Show a sample of rows from Table A, same for Table B and then what your result for the target table need to look like. We'll attempt to infer the rules from that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

Here is the requirement

Table 1 has it's own sequence number.
Table 2 need to get table 1 sequence number + it's own sequnce number (+ few other coulmns)
Table 3 need to get table 1 sequence number + table 2 seqence number + it's own sequnce number (+ few other coulmns)

Hope this is some what beter
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

How will you get Table1's sequence number in Table2's data? There must be a common key, right?
As you keep saying "get", I am assuming all this is in the selection and not loading.
For this you have to have atleast one key that is common between the tables. Identify that key and you are good to go.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
devanars
Premium Member
Premium Member
Posts: 99
Joined: Thu Nov 30, 2006 6:25 pm

Post by devanars »

Here is a composite key ( combination of 3 keys).
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You need natural keys, regardless whether its meaningful or meaningless.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Can we get examples please? Not words, but example values. Show us a small number of values from all three tables and then how they would all fit together. Forget the "few other columns" part, just the "keys".

Maybe then we'll have some idea what "get Table 1 sequence number" means or what your end game is. Right now we still have no clue and I'm close to giving up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply