交叉表联接错误



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

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

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

你不能做UPDATE ... FROM .这是完全无效的语法。也许您正在考虑INSERT INTO ... SELECT FROM

最新更新