rtvalluri rtvalluri - 1 year ago 64
SQL Question

Multiplying two columns of same table and storing result to the third column of same table

I m having a table


After supplying the
need to be calculated as

I want to multiply
columns and store the result in
column of same table.

I have tried this:

insert into SALES(totalcost) select quantity*costperunit as res from SALES

But It failed!

Somebody please help me in achieving this..
Thanks in Advance

Answer Source

You need to use update.

UPDATE SALES SET totalcost=quantity*costperunit
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download