I need to compare records between two tables. I need to get the first record from table1 and compare it with all records in table 2 and replace the value from table 1 with the value from table 2
Table1
Column1
A
B
C
AA
Table2
Column1
AA
A2
A
B
C
DD
Technology Tips and News
I need to compare records between two tables. I need to get the first record from table1 and compare it with all records in table 2 and replace the value from table 1 with the value from table 2
Table1
Column1
A
B
C
AA
Table2
Column1
AA
A2
A
B
C
DD
One way is to use a cursor to process all records (rows) in table 1 in a WHILE loop:
Example for cursor usage:
How to architect running total using cursor?
Cursors do not scale well, so the first choice is set-based operations. Nonetheless, in your case you may find the logic easier to build with cursor. Later you may try to convert the logic to set-based.
And what will be desired result based on above example?
CREATE TABLE w