How to compare the cell values of two data tables

Viewed 11479

If i have two data tables with same structure,the same primary key and the same number of columns .

How to compare their content and detect the cells which are not the same in the two data tables ?

ex:

TB_Offline

emp_num(key)  salary      ov    

 455           3000      67.891   
 677           5000      89.112    
 778           6000      12.672   

TB_Online

emp_num(key)  salary      ov  

 455           3000      67.891 
 677           5000      50.113 
 778           5500      12.672   

I want to get result like this(or some structure to show the differences) :

emp_num(key)| salary_off |salary_on|s1   | ov_off  |  ov_on  |s2         

   677      |   5000     |    5000 | 1   |  89.112 |  50.113 | 0    
   778      |   6000     |    5500 | 0   |  12.672 |  12.672 | 1 

NOTE:

455 doesn't exist in the result because it was the exact in all columns among the two datatables.
8 Answers
Related