性能问答>从SQL中的选择查询中将值设置为NULL>
2回复
2年前

从SQL中的选择查询中将值设置为NULL



一个选择查询获取了这样的数据:

SELECT cpe.entity_id,
       cpe.type_id,
       cpe.sku,
       cped.value AS "PRICE"

FROM catalog_product_entity AS cpe

LEFT JOIN catalog_product_entity_decimal AS cped 
ON cped.entity_id = cpe.entity_id

WHERE cpe.type_id = 'configurable' AND cped.attribute_id = 77

现在想将所有行的 cped.value 列更新为 null:

UPDATE 
    cped
SET
    cped.value = NULL
FROM 
    catalog_product_entity AS cpe
    LEFT JOIN catalog_product_entity_decimal AS cped 
    ON cped.entity_id = cpe.entity_id
WHERE 
    cpe.type_id = 'configurable' 
    AND cped.attribute_id = 77

但它在第 5 行的“FROM catalog_product_entity AS cpe LEFT JOIN catalog_product_entit ...”附近出现语法错误。

 

怎么办!各位大佬求解!

713 阅读
请先登录,查看2条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步