>I have a source-field and now I want to make an extra calculated-fieldYou can set the calculated field from the source field:>like the following example:
update table set calculated=big_messy_formula(Source);
which will *NOT* update Calculated if you change Source with
UPDATE or by inserting more rows.
Or, you can select the field when you want to use it:
select *, big_messy_formula(Source) as Calculated from table;
Here, big_messy_formula(Source) represents a formula using Source
and perhaps other variables. It doesn't *have* to be a user-defined
function.
In later versions of MySQL (> 5.0), you can use triggers to
update Calculated whenever Source changes.
Gordon L. Burditt
Bookmarks