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 |
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-05-05 : 05:21:37
|
| table MoneyKID---Money 1---1000 2---2000 3---3000table S_MoneyKID---sMoney 1---10 2---20 3---30i want an update query to select all from table s_Money and update them to table Moneyresult will be like thistable MoneyKID---Money1---10102---20203---3030update Money set Money = (subqery)i tried this but give subqeruy error. Cant we use subquery with update command?MS BLESS US |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-05-05 : 05:26:28
|
[code]update m set m.Money = m.Money + s.Moneyfrom Money m inner join S_Money son m.KID = s.KID[/code] KH |
 |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-05-05 : 05:31:07
|
| ok i have fixed it without innerjoinMS BLESS US |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-05-05 : 05:34:09
|
with subquery ?update m set m.Money = m.Money + (select Money from S_Money x where x.KID = m.KID)from Money m KH |
 |
|
|
|
|
|