How to get matched records between two columns
Moderators: chulett, rschirm, roy
How to get matched records between two columns
Hi,
I have two columns in my source table Key_Pln_N and key_pln and my reference table column is key_pln_n1. now, i want to compare with key_pln_n1 and Key_Pln_N. If there is any unmatched records between these two columns i have to populate those records in to my dataset. Plz help me to resolve this problem
I have two columns in my source table Key_Pln_N and key_pln and my reference table column is key_pln_n1. now, i want to compare with key_pln_n1 and Key_Pln_N. If there is any unmatched records between these two columns i have to populate those records in to my dataset. Plz help me to resolve this problem
prabakaran.v
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I am doing in datastage only. My source is dataset which is having 6 records where key column is Key_Pln_N and my reference table is db2 which is having 29 records where key column is key_pln_n1. I want compare the records between these two columns. if records are unmatched between these two columns, i want to insert those unmatched records in my target table. I have created one stage variable there i have written query like this
stgvar:
If DSLink73.Key_Pln_N <> DSLink73.key_pln_n1 Then 1 Else 0
then constraints i written stavar=1.
But i got all records from the source dataset. I hope now i clearly explained my problem.
stgvar:
If DSLink73.Key_Pln_N <> DSLink73.key_pln_n1 Then 1 Else 0
then constraints i written stavar=1.
But i got all records from the source dataset. I hope now i clearly explained my problem.
prabakaran.v
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 22
- Joined: Tue Aug 19, 2008 7:44 pm
Hi,
You can do something like this:
1) get 1 as Dummy from the reference table.
2) Use Join stage: Left Outer Join. left link: input link from dataset and right link is input link from reference table.
3) Next use a filter stage and output records based on dummy<>1. All the unmatched records will have dummy=0.
I hope this solves your problem.
You can do something like this:
1) get 1 as Dummy from the reference table.
2) Use Join stage: Left Outer Join. left link: input link from dataset and right link is input link from reference table.
3) Next use a filter stage and output records based on dummy<>1. All the unmatched records will have dummy=0.
I hope this solves your problem.
Last edited by etldeveloper2050 on Thu Sep 18, 2008 12:05 am, edited 1 time in total.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Ur was a city in ancient Babylonia.
The second person personal pronoun in its possesive form is spelled "your" in English.
Please strive for a professional standard of written English on DSXchange.
You would not use SMS-style abbreviations in your formal work documentation, would you?
You are communicating with the same group of people (potential future maintainers) when you post on DSXchange.
The second person personal pronoun in its possesive form is spelled "your" in English.
Please strive for a professional standard of written English on DSXchange.
You would not use SMS-style abbreviations in your formal work documentation, would you?
You are communicating with the same group of people (potential future maintainers) when you post on DSXchange.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
For completeness, the nullability of the 'dummy' field affects the value it is set to after the join. If NULL is allowed, then the unmatched 'dummy' field will be set to NULL. If NULL is not allowed then the unmatched field will be 0.
Let's hope Ray didn't hurt himself when dismounting from his high horse!
Let's hope Ray didn't hurt himself when dismounting from his high horse!
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 22
- Joined: Tue Aug 19, 2008 7:44 pm
Before boarding on to this forum(or job), it is worth spending some time with documentation.
And even before that... be clear with you question... to avoid conflicting answers.
"How to get matched records between two columns?"
...conflicts with..
"... i want to insert those unmatched records in my target table. "
What do you want mate?
And even before that... be clear with you question... to avoid conflicting answers.
"How to get matched records between two columns?"
...conflicts with..
"... i want to insert those unmatched records in my target table. "
What do you want mate?
Before boarding on to this forum(or job), it is worth spending some time with documentation.
And even before that... be clear with you question... to avoid conflicting answers.
"How to get matched records between two columns?"
...conflicts with..
"... i want to insert those unmatched records in my target table. "
What do you want mate?
And even before that... be clear with you question... to avoid conflicting answers.
"How to get matched records between two columns?"
...conflicts with..
"... i want to insert those unmatched records in my target table. "
What do you want mate?
Re: How to get matched records between two columns
If I understand you correct, your source records are in a table.praburaj wrote:Hi,
I have two columns in my source table Key_Pln_N and key_pln and my reference table column is key_pln_n1. now, i want to compare with key_pln_n1 and Key_Pln_N. If there is any unmatched records between these two columns i have to populate those records in to my dataset. Plz help me to resolve this problem
If you are using Oracle or Teradata Database then you may use the respective Database Stage or the ODBC stage and do your Join query inside the stage sending the output link to your dataset.
If you are not sourcing a table then you could use the join stage.