Click here to Skip to main content
15,923,164 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to sum nehative and positive numbers in SQL. But I am getting error when doing so.

Expression:
(sum(-0.112, @Transaction1*0.234, @Transaction2 *(-0.88))

Can I get help on this please?
Posted
Updated 28-Oct-15 5:49am
v2

SQL
SELECT -0.112 + 0.234 * @Transaction1 - 0.88 * @Transaction2 As Computed

But I'm not really sure this is what you are searching for.
 
Share this answer
 
Comments
apr1234 28-Oct-15 12:02pm    
Thanks... It helped :)
phil.o 28-Oct-15 13:40pm    
You're welcome :)
Maciej Los 28-Oct-15 15:42pm    
5ed!
The Sum function is a column aggregate. That means that you enter one column name of a set of data.

You can add them with the '+', create a temp table or cte, or use a pivot method depending on how much data you need to sum
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900