[英]How to update all records by adding custom name for all the entry
I have facing a problem. 我遇到了一个问题。 I want to update all my database field value by adding a custom name at the beginning of the row.
我想通过在行的开头添加一个自定义名称来更新所有数据库字段值。 Here is an example.
这是一个例子。
In the above picture i want to add a folder name image
at the beginning of each record in the table. 在上面的图片中,我想在表中每个记录的开头添加一个文件夹名称
image
。 But I am unable to do it. 但是我做不到。 Sorry for my bad English.
对不起,我的英语不好。
It sounds like you just want this update: 听起来您只想要此更新:
UPDATE yourTable
SET image_large = CONCAT('image/', image_large);
But if I get a vote, then I suggest that you just add this prefix in your presentation layer. 但是,如果我有投票权,那么建议您仅在演示文稿层中添加此前缀。
Call a UPDATE
like this (simplified) 像这样调用
UPDATE
(简体)
UPDATE table SET field1 = concat('image/', field1);
Backup your data before. 之前备份数据。 And be aware without a
WHERE
clause it will update every row! 请注意,如果没有
WHERE
子句,它将更新每一行!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.