Welcome to Microsoft T-SQL Q&A Forum!
Please check this：
Create table #Employee_Cleanup ( EMp_id int, TypeOfRecord varchar(10), name varchar(100), address varchar(100), email varchar(100), phonenumber varchar(10) ) insert into #Employee_Cleanup values (200,'new', 'WillSmith', '','','0000000') insert into #Employee_Cleanup values (200,'old', 'WillSmith', 'philly','Hit1234@gmail.com','43555332') insert into #Employee_Cleanup values (100,'new', 'ChrisRock', '','','65321332') insert into #Employee_Cleanup values (100,'old', 'ChrisRock', 'southcarolina','email@example.com','12321332') select * from #Employee_Cleanup update new set new.address=old.address,new.email=old.email from #Employee_Cleanup new inner join #Employee_Cleanup old on old.EMp_id=new.EMp_id where new.TypeOfRecord='new'and old.TypeOfRecord='old' select * from #Employee_Cleanup
Here is the result:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.