简体   繁体   English

使用多个子查询更新查询

[英]Update query with multiple subqueries

Here is the update I'm trying to run: 这是我要运行的更新:

UPDATE  oc_product_gpf SET
brand =  '(select name from oc_manufacturer where manufacturer_id=
(select manufacturer_id from oc_product where product_id = oc_product_gpf.product_id) )'
WHERE  oc_product_gpf.gpf_id =2454;

The error I'm receiving is '#1406 - Data too long for column 'brand' at row 1' 我收到的错误是“#1406-数据对于第1行的“品牌”列而言过长”

Any suggestions? 有什么建议么? Thanks in advance! 提前致谢!

Your subquery not acting as a subquery here. 您的子查询在这里不充当子查询。 it simply act as a string and trying to assign to "brand" column. 它只是充当字符串并尝试分配给“品牌”列。 Please remove the '' or convert that in to a join 请删除“”或将其转换为联接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM