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 |
joechungath
Starting Member
1 Post |
Posted - 2013-11-29 : 12:13:07
|
Hi Guys,I'm new to sql and I desperately need your help.Query for transferring money from one account to another account in same table..so from one account money should be deducted and need to be add into another account.JC |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2013-11-29 : 12:19:17
|
declare @ac1 int = 857declare @ac2 int = 945declare @amt = 10update tblset bal = case when ac = @ac2 then bal + @amt when ac = @ac1 then bal - @amt endfrom tblwhere ac in (ac1,ac2)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|