简体   繁体   English

如何基于同一行中的其他列值更新mysql表列

[英]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.

相关问题 从MySQL表的一列获取字符串值,并更新同一行的另一列值 - Get string value from one column of MySQL Table and update its other column value of same row 使用mysql中相同表的其他列的行更新行 - Update row with values of other column's row of same Table in mysql 在MySql中存在一对多关系的情况下,如何基于同一行的另一列的值获取一列的值 - How to get the value of one column based on the value of other column of same row in case of one to many relation in MySql 根据MYSQL中同一表中的另一列更新列中的值 - Update value in a column based on another column in the same table in MYSQL MYSQL基于同一表中的行划分列值 - MYSQL Divided column value based on row from the same table MySQL - 基于同一个表中的行的总和列值 - MySQL - sum column value(s) based on row from the same table MYSQL触发器更新列,其中同一列基于其他列 - MYSQL Trigger Update column with same column based on other column MySQL - 触发器根据更新其他表列值更新列值 - MySQL - Trigger to update a column value based on update other table column value 如何使用同一行中其他列的公式和数据自动更新MYSQL列值? - How to automatically update a MYSQL column value using formula and data from other columns in same row? 根据行=列名更新mySQL表 - Update mySQL table based on row=column name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM