繁体   English   中英

#1064语法错误:在“更新查询”中

[英]#1064 Syntax Error : In “Update Query”

当我使用这个mysql代码

update catalog_product_entity_decimal
  set value = "6.0000" 
  where attribute_id = 75 and
        entity_in ( SELECT 
        product_id 
        from `catalog_category_product` 
        WHERE category_id =37 );

我收到这个错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT product_id from `catalog_category_product` ' at line 4

我不知道我的查询出了什么问题。 有人可以告诉我怎么了吗?

谢谢

您在entity_in之后缺少IN子句。 用这个:

update catalog_product_entity_decimal
  set value = "6.0000" 
  where attribute_id = 75 and
        entity_id IN ( SELECT 
        product_id 
        from `catalog_category_product` 
        WHERE category_id =37 );

我认为catalog_category_product将不包含'符号。 不使用'符号尝试查询

你错过了= OR in查询

暂无
暂无

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

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