Calculation in Query
Posted on 2009-04-08
I am trying to run a query against a MYSQL DB that is giving me the wrong calculation.
4 fields.. A is a total of B, C and D so that leaves me with the total and 3 of the 4 other values but i also need to calculate for the 4th value by subtracting values B,C, and D from the A..after that i need to multiply the values against a number and add it all together? Here is the formula that im using in case that makes no sense which i doubt it will...
(A-B-C-D) + (B*2) + (C*3) + (D*4) = Answer
Remember A is a total of B, C and D
not as complicated as my question i hope...any ideas the syntax to use?
here is the Query im trying which is giving the wrong result
SELECT ((A-B-C-D)+(B*2)+(C*3)+(D*4)) AS total FROM DB