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 |
davecarrera
Starting Member
4 Posts |
Posted - 2007-05-29 : 03:00:32
|
Hi All,I have a result that for whatever reason has account credits posted to table as a positive number.What i would like to do is add a dynamic colomn to my result that says something like if ref like 'CN%%%%%%%' then newvalue=val*-1 (to make it a negative value) else it stays positive.I am not very clued up on this and i should say that this is via RS so any help or advise is really appreciated.Kind ReagardsDave |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-29 : 03:04:01
|
Please post in appropriate forum.select case when ref like 'CN%' then -val else val end as new_columnfrom yourtable KH |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-29 : 07:07:07
|
moved from Article discussion._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
davecarrera
Starting Member
4 Posts |
Posted - 2007-05-29 : 07:10:26
|
Sorry about posting in wrong area. Only noticed after i did it, silly me.... :-)Thanks for the help Khtan, will give that agoMany thanksDave |
 |
|
|
|
|