I have a table (table1) with a bunch of records say 50.
this table has a code that is repeated in one column for the 50 records, example code is 123456
I want to update/change code 123456 to a new code based on a list of distinct codes stored in a second table (table2) but evaluate and update one at a time, example below
example: the first distinct code from table2 is code 456789, I want to take that code and update code 123456 in table1 to 456789 in table1 and then append these records from table1 to a 3rd table (table3)
then repeat the process for each distinct code in table2,
next code
the second distinct code from table2 is code 666666, I want to take that code and update code 456789 in table1 to 666666 in table1 and then append these records from table1 to a 3rd table (table3)
and repeat, repeat, repeat
I know you have to use a variable and loop but not that sure how to accomplish.
thanks
this table has a code that is repeated in one column for the 50 records, example code is 123456
I want to update/change code 123456 to a new code based on a list of distinct codes stored in a second table (table2) but evaluate and update one at a time, example below
example: the first distinct code from table2 is code 456789, I want to take that code and update code 123456 in table1 to 456789 in table1 and then append these records from table1 to a 3rd table (table3)
then repeat the process for each distinct code in table2,
next code
the second distinct code from table2 is code 666666, I want to take that code and update code 456789 in table1 to 666666 in table1 and then append these records from table1 to a 3rd table (table3)
and repeat, repeat, repeat
I know you have to use a variable and loop but not that sure how to accomplish.
thanks
Comment