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 |
snow12
Yak Posting Veteran
74 Posts |
Posted - 2011-01-20 : 10:51:15
|
Hello:I have table a and would like update table a whose values from table b, but not update all rows at table a. Only update record ID in table a match record ID in tableC.Here is my queryupdate aset a.Desc = b.Desc,a.Value = b.Valuefrom TableA a, TableB bwhere a.name = b.nameand a.ID = b.IDand a.ID in ( select ID from TableC)I only have 12 a.ID match TableC, but above query update whole TableA.How to only update 12 record at TableA from TableB?Thanks |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-20 : 13:52:53
|
update aset a.Desc = b.Desc,a.Value = b.Valuefrom TableA ajoin TableB bon a.name = b.name and a.ID = b.IDand exists(select * from tableC as c where c.ID = a.ID) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
snow12
Yak Posting Veteran
74 Posts |
Posted - 2011-01-20 : 16:13:13
|
Thank you very much! |
 |
|
|
|
|