ahmed
ahmed

Reputation: 14666

mysql: how to sum 2 fields in the table and put the result in the 3rd field?

lets say our table has the following structure

        col1 | col2 | col3

I want to sum col1 and col2 then update the col3 with the result

Thanks

Upvotes: 1

Views: 243

Answers (1)

gahooa
gahooa

Reputation: 137312

UPDATE tablename SET col3 = col1 + col2

Upvotes: 6

Related Questions