Page 1 of 1

Calculated Fields... Question/Problem when updating..

Posted: Mon Sep 08, 2003 10:04 pm
by parkin
Hi..
I was wondering how do you update a calculated field in mysql? Using mysql? Are there any functions that could help you? Or do I have to create one?

Code: Select all

eg:
field 1 value: 10
field 2 value: 5
field 3 value: 15        (field 1 + field 2) 

then when i update and change field 2.. value: 8
I would like field 3's value to change..
So now field 3 value should be: 18
Can anyone help? :) I couldn't find much so far that could help me with this :(


any comments/ help.. is appreciated :wink:
Thanks alot! :)

Posted: Tue Sep 09, 2003 4:18 am
by twigletmac
Personally I wouldn't bother with field 3, and do the calculations with the data when retrieving it for display, e.g.

Code: Select all

SELECT field1, field2, (field1 + field2) AS field3 FROM table
Mac