I want to add values of few fields in a row and then divide it by a constant value and store the result in a new field on the same row. How can i do this ?.
How to perform mathematical operation on field values in a table ?
Collapse
X
-
Tags: None
-
You could run an update query to store the result in the empty field.
[code=sql]
UPDATE yourTable
SET result = (firstNumber + secondNumber) / constant
[/code]
This would store the the value of the sum of firstNumber and secondNumber divided by the constant in the field result of the table yourTable. The field result must already exist in yourTable.
Though in most cases calculated fields are done through queries rather than stored as their own field.
Jking -
How can i add values in the fields of a table and store the result in a new field of the same table.Originally posted by JKingYou could run an update query to store the result in the empty field.
[code=sql]
UPDATE yourTable
SET result = (firstNumber + secondNumber) / constant
[/code]
This would store the the value of the sum of firstNumber and secondNumber divided by the constant in the field result of the table yourTable. The field result must already exist in yourTable.
Though in most cases calculated fields are done through queries rather than stored as their own field.
JkingComment
Comment