[英]How to update mysql table column based on other column value in same row
I have mysql table like this. 我有这样的mysql表。
table_categories - scid, scname, scimage
I want to update scimage field of each row to "/images/subcategories/"scid".png" 我想将每一行的scimage字段更新为“ /images/subcategories/"scid".png”
update table_categories set scimage = "/images/subcategories/" + <What should i write here, so it take scid value> + ".png"
Just write your column name like: 只需将您的列名称写为:
update table_categories set scimage = "/images/subcategories/" + scid + ".png"
If your column type is not varchar you must convert your datatype at the first . 如果您的列类型不是varchar,则必须首先转换数据类型 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.