如何根据同一行中的其他列值更新mysql表列

时间:2015-11-25 14:37:02

标签: mysql

我有这样的mysql表。

table_categories - scid, scname, scimage

我想将每行的scimage字段更新为“/images/subcategories/"scid".png”

update table_categories set scimage = "/images/subcategories/" + <What should i write here, so it take scid value> + ".png"

1 个答案:

答案 0 :(得分:0)

只需将您的列名称写为:

update table_categories set scimage = "/images/subcategories/" + scid + ".png"

如果您的列类型不是varchar,则必须convert your datatype at the first