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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 subtracting values before updating

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-01-27 : 11:42:30
hi i need to do something like this


NotAmount WITH OptPrem - NotAmount FOR POS_TYP equals to "S" AND INV_SECTYPE_COD equal to '52','53','54' or '55'

how can this be done

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-27 : 14:05:24
show us your table structure with some sample data and explain what you want as output.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-01-28 : 04:42:46
there isnt really much of a table structure 1 table with alot of columns in it.

i want to take away OptPrem - NotAmount set that to NotAmount where POS_TYP equals to "S" AND INV_SECTYPE_COD equal to '52','53','54' or '55'.

just dont know how to start it of
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-01-28 : 04:53:04
[code]update yourtable
set OptPrem = OptPrem - NotAmount
where POS_TYP = 'S'
and INV_SECTYPE_COD in ('52','53','54','55')[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-01-28 : 05:28:27
thanks
Go to Top of Page
   

- Advertisement -