How to add field values in mysql

Hi Im looking for a simple way to to create a field with values derived from other fields.
Eg I have a field called A and one called B I want to create a field called C which is equal to A*B.
How can I do this in mysql. Thanks in advance.
LeighJorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kim RyanIT ConsultantCommented:
You could try an update statment

update table_name set c = a*b;

If c does not exist, you would need to use the alter table statement frist to create it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeighJorAuthor Commented:
I put in
UPDATE item Set C =`CostPerUnit`*`MultiplierPack`
where Item is tablename.

Get error : Unknown column 'C' in 'field list'  ..so I suppse here is where I use alter. what is syntax of alter statement.
PS
I need to use Mysql and basically like the little I know. But in Acces to do same you only had to SELECT...AS EXPRESSION. Isnt there anything like that in Mysql.
Cheers and Thanks
0
Kim RyanIT ConsultantCommented:
try this
alter table item add column C integer;
integer is the data type but you may want to use decimal or float
0
LeighJorAuthor Commented:
Excellent. Thank you. Easy Peasy. Cheers Mate
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.