使用另一列的值更新列 +文本

发布于 2024-10-09 15:00:06 字数 367 浏览 0 评论 0原文

我将电子商店的数据库值导入到我自己的数据库中,大部分情况下效果很好。但是,没有图像文件名。因此,我需要更新整个数据库 - 超过 6,000 条记录,以便在“图像”下我们得到路径 + 型号名称 + jpg,这样每个产品都可以与图像关联。我在将动态列值与静态路径混合时遇到问题。这是我需要完成的任务:

UPDATE `store`.`pr_product` 
SET `image` = 'data/products/`**model_no**`.jpg' 
WHERE `pr_product`.`product_id` = `pr_product`.`product_id` ;

但无法让它识别“model_no”的动态性质,

提前致谢

I imported an e-store's database values into my own, and it mostly worked out fine. However, there were no image file names. So, I need to update the entire database- over 6,000 records, so that under 'image' we get a path + model name + jpg, so each product can be associated with an image. Im having trouble mixing the dynamic column value with the static path. Here is what I need to accomplish:

UPDATE `store`.`pr_product` 
SET `image` = 'data/products/`**model_no**`.jpg' 
WHERE `pr_product`.`product_id` = `pr_product`.`product_id` ;

But cannot get it to recognize the dynamic nature of 'model_no'

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凝望流年 2024-10-16 15:00:06

Max,

请问“model_no”的动态性质是什么意思?
此列的数据类型是 int 还是 long 还是 varchar

请需要更多示例说明,

您可以测试以下内容,例如 model_no 是 pr_product 表中的列

UPDATE store.pr_product 
SET image = 'data/products/'+pr_product.model_no+'.jpg' 
WHERE pr_product.product_id = pr_product.product_id ;

最好的祝福,

Mohammed Thabet Zaky

Max,

Please what you means about dynamic nature of 'model_no'?
Is this column's datatype int or long or varchar

Please need more explaination with example

you can test the following if e.g model_no is column in pr_product table

UPDATE store.pr_product 
SET image = 'data/products/'+pr_product.model_no+'.jpg' 
WHERE pr_product.product_id = pr_product.product_id ;

Best Regards,

Mohammed Thabet Zaky

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文