Hi I am trying to create something but I can't have my total number being a negative. So basically I got values that are negative that can be multiplied into a somewhat complex mathematics equation.
So essentially... user inputs a data from -1 to 1. (-1, 0, 1) And it get's multiplied into my formula. So my SQL query looks like this... (this part works!)
SELECT *, a, b, c AS TOTALNUMBER FROM MATH
ORDER BY TOTALNUMBER DESC
However, I need the total number to always be positive. So I have been trying for the past few hours to figure this out. I am sort of new to php/sql.
I am trying to include something like...
if (TOTALNUMBER < 0 ) {
TOTALNUMBER * -1.0
}
However I have no idea where to include this in the query or how to write it properly.
To clarify and update what I am looking for... User can input -1,0,1
Data for A, B, C is for example. 10, 15, 20 User inputs: 1, -1, 0
A total = 10
B total = -15
C total = 0
Total ABC = -5
However, I need total to be 5 instead of -5 without changing any A, B, C values.