开发者

MySQL Query For Copying Contents Into Another Field, Same Row

开发者 https://www.devze.com 2022-12-25 04:59 出处:网络
Is there a single query (subqueries in it are allowed) where I can copy the content of one field into another field, per row. Example:

Is there a single query (subqueries in it are allowed) where I can copy the content of one field into another field, per row. Example:

pri开发者_运维百科ce, and priceBackup

Records:

45.55

47.77

45.55 copies into priceBackup for that specific row,

47.77 copies into priceBackup for that specific row.

I do have a primary key, auto increment on it under 'id'.

Thanks guys!


UPDATE table1 SET priceBackup = price

Add a WHERE clause if you only want to do this for some rows.


update table blah set priceBackup=price;

0

精彩评论

暂无评论...
验证码 换一张
取 消