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 |
|
normannen
Starting Member
4 Posts |
Posted - 2011-11-14 : 10:11:23
|
| Hi.Can anyone help me with this ?I have 2 tables.One is used to update the other one with.I need to read from TableUpdate and change rank and add the increase in salary to TableMain.And this is for all rows in that table.It has to match each persons row and update it.Have tried some examples, but failed.TableMainName (Mike, John, Jack, etc)Rank (1,2,3,4, etc)Salary TableUpdateNameRankNew (To replace the old one)SalaryIncrease (A amount to be add to the ordinary salary).Thanks in advance. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-14 : 10:24:09
|
| [code]UPDATE mSET m.Rank = u.RankNew,m.Salary = m.Salary + u.SalaryIncrease FROM TableMain mINNER JOIN TableUpdate uON u.Name = m.Name[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
normannen
Starting Member
4 Posts |
Posted - 2011-11-14 : 10:52:23
|
| Thanks, I'll try that... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-14 : 10:53:47
|
| np...let us know if you face any issues------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|