【发布时间】:2014-07-21 20:41:22
【问题描述】:
我想根据 ID 将 magento 属性的值从一行复制到同一表中的另一行,但前提是目标列为空。
我有一个值 attribute_id=99,即价格,例如 19.99,我想将此值复制到一个新属性(即 attribute_id=1030)我下面的测试查询工作正常并更新 entity_id = 1030 的行(这是每个产品 ID)我不希望手动更改该数字我希望查询更新所有在 attribute_id = 1013 中没有值的产品,其值来自 attribute_id = 99
UPDATE catalog_product_entity_decimal
SET value = (select value from (select value from catalog_product_entity_decimal where attribute_id = 99 AND entity_id = 1030) AS x)
WHERE attribute_id = 1013 AND attribute_id IS NULL AND entity_id = 1030;
实际上,我希望 entity_id = xxxx 匹配,因为它可以通过表格更新所有项目来工作。例如1030, 1031, 1032 ... 1099 ... 15001
【问题讨论】: