UPDATE table1 INNER JOIN table2 ON table1.columna=table2.columnd SET table1.columnb=table2.columne - table2.columnf / 2 + table2.columnf Code (markup): For some reason it will not subtract correctly in the query not sure what I am missing. columne columnf 45 90 60 90 example taken from the first line above.. 45-90/2+ = 67.50<< in the calculator I am not getting the same amount in the query. It seems like the numbers aren't subtracting when it goes negative so in other words negative numbers are looking positive.. I think the database is reading -5.00 as 5.00 instead.. Any ideas or suggestions?
did you have "bodmas" when you were a kid at school... if you need more control over the order that the equation is handled put some brackets in.
at a guess I'd put UPDATE table1 INNER JOIN table2 ON table1.columna=table2.columnd SET table1.columnb= (table2.columne - table2.columnf) / (2 + table2.columnf) basically whatever is in the brackets will be calculated first, then division and multiplication and finally addition and subtraction. If you need the order to be different then you need to add brackets to control it.