Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 compare two table and update

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2015-04-27 : 17:28:08
Hi All.
I compare two table with JOIN statement. Now I would like to update one of them base on result. How it to do?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-04-27 : 17:33:45
update t2
set c2 = t1.c2, c3 = t1.c3, ...
from t1
join t2 on t1.c1 = t2.c1
where ...

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

eugz
Posting Yak Master

210 Posts

Posted - 2015-04-28 : 11:09:14
Hi tkizer. Thanks.
Go to Top of Page
   

- Advertisement -