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.
Author |
Topic |
beemd
Starting Member
14 Posts |
Posted - 2013-10-28 : 16:19:53
|
Hi,If I have two tables like this (simplified example)dbo.aid value1 A2 B3 Cdbo.bid value123I want to update b and set the value from a where the id's match? Could someone point me in the right direction?Thanks |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-10-28 : 16:48:51
|
You can do it like shown below:UPDATE b SET value = a.VALUEFROM a INNER JOIN b ON a.id = b.id; The only thing to be careful about is that if there is more than one row in table a for a given id in table b, it is unpredictable which of those rows in table a will be used to pick the value from to be used to update b |
|
|
|
|
|