简体   繁体   中英

#1064 Syntax Error : In “Update Query”

When I use this mysql code

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 );

i'm getting this error

#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

I couldn't figure out what's wrong with my query. Can someone tell me what's wrong?

Thank you

You are missing the IN clause after entity_in. Use this:

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 );

I think catalog_category_product will not contain the ' symbol. Try the query without using the ' symbol

你错过了= OR in查询

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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