Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Compare each row of two tables field by field

Hi,
I have two tables say A and B. Table A has 10 fields and table B has 5 fields, those 5 fields of table B are present in table A as well. I need to compare those 5 fields from both tables based on primary key and print the differences if any on screen. Can we achieve this using talend? Kindly suggest.
Regards,
Babu
Labels (2)
5 Replies
Anonymous
Not applicable

Hi Babu
Which DB type are you using? Let's assuming you are using Mysql, select records from the two table and do inner join on tMap base on the primary key, the job looks like:
tMysqlInput_1(select records from table a)-----main---tMap---main---tLogRow
|
lookup
|
tMysqlInput_2(select records from table b)
Best regards
Shong
_AnonymousUser
Specialist III
Specialist III
Author

Hi Babu
Which DB type are you using? Let's assuming you are using Mysql, select records from the two table and do inner join on tMap base on the primary key, the job looks like:
tMysqlInput_1(select records from table a)-----main---tMap---main---tLogRow
|
lookup
|
tMysqlInput_2(select records from table b)
Best regards
Shong

Hi Shong,
I have done same flow as mentioned above.THe same thing when i applied it to compare 2 excel i am getting the output correct.But when i am comparing 2 tables of same structure eventhough the values are same in all columns in all tables i am getting the output stating there is some difference.
I am not sure what is going wrong becaus the same thing works in excel but not with tables.COuld you pls help in this.
Anonymous
Not applicable

Hi
Maybe there exists space in some value, go to check it and trim the value before doing the join on tMap.
Shong
_AnonymousUser
Specialist III
Specialist III
Author

Hi
Maybe there exists space in some value, go to check it and trim the value before doing the join on tMap.
Shong

THx Shong.I tried comparing only one filed with BIGINT value in 2 tables.Even then i am getting the ouput stating there is some difference.
EG table 1 column A value 345
table 2 column A values 345
THe output should be there is no difference.But i get the output as there is some difference.
Anonymous
Not applicable

problem can be in Java comparing
if type is bigdecimal :
b1.intValue() == b2.intValue()
or Var.D1.equals(Var.D2)
ps it is good to provide screens of jobs and more info about DB (name,version) and DDL