I need to move data from column reg
in table1
to reg2
in table2
, where the ID
of table1 = 'ID2'
of table2
.
basically, I need to shift car registrations from A to B as long as the person exists in B.
I need to move data from column reg
in table1
to reg2
in table2
, where the ID
of table1 = 'ID2'
of table2
.
basically, I need to shift car registrations from A to B as long as the person exists in B.
update table column by using join
update t2
set t2.reg2=t1.reg
from table2 t2 inner join table1 t1
on t2.ID2=t1.ID
INSERT INTO table2 (reg2)
SELECT reg
FROM table1
WHERE table2.ID2 = table1.ID;