1

不幸的是,我不知道问题是什么?

UPDATE catalog_product_entity_varchar SET value = '{somevalue}'

    FROM cataloginventory_stock_item AS csi
    JOIN catalog_product_entity AS cpe ON cpe.entity_id = csi.product_id
    JOIN catalog_product_entity_varchar AS cpev ON cpev.entity_id = cpe.entity_id

WHERE attribute_id = '1691' AND sku = '605284470695';

错误

Error Code: 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 'FROM cataloginventory_stock_item AS csi      JOIN catalog_pr' at line 3
4

2 回答 2

1

SET子句应位于表引用之后:

UPDATE
  cataloginventory_stock_item AS csi
  JOIN catalog_product_entity AS cpe ON cpe.entity_id = csi.product_id
  JOIN catalog_product_entity_varchar AS cpev ON cpev.entity_id = cpe.entity_id
SET cpev.value = '{somevalue}'
WHERE attribute_id = '1691' AND sku = '605284470695';
于 2012-04-27T19:23:34.860 回答
0

你不能这样做UPDATE ... FROM。那是完全无效的语法。也许你在想INSERT INTO ... SELECT FROM

于 2012-04-27T19:23:15.277 回答