Reputation: 1198
Is it possible to this dynamically Add(stage_1 + stage_2)
and get the total saved into the column called total
. I am using phpMyAdmin. And the stage columns are of type float
.
Car stage_1 stage_2 total 1 30 50 80 2 28 51 79 3 31 51 82
Thanks in advance for any help.
Upvotes: 0
Views: 22
Reputation: 70344
Try this:
update cartable set total = stage_1 + stage_2
In fact, instead of storing the column total in the database, you could just create a view:
create view carview as
select Car, state_1, stage_2, stage_1 + stage_2 as total
from cartable
Upvotes: 1