I have two tables similar to following construct. I need to compare both and get the output as shown in results.
Here I am comparing column1 with column4, column2 with column5 and column3 and column6.
Table1:
Key column1 column2 column3
1 4 5 6
2 2 5 8
3 4 5 10
4 4 6 10
Table2:
Key column4 column5 column6
1 6 5 6
2 2 5 8
3 4 5 10
4 4 8 10
Result should be:
Key1 Table2ColumnName Table1ColumnValue Table2ColumnValue
1 column4 4 6
4 column5 6 8
Note : In actual case, I have tables with huge number of columns to compare. Column names in both table are different.
Could someone kindly guide on how to achieve the above requirement.