【发布时间】:2014-08-26 04:20:55
【问题描述】:
我需要选择一个 product_id 的成本值,然后更新该 product_id 的最小值
我不需要合并这两个选择语句,然后运行更新。 我需要从一个字段中获取成本,然后将公式乘以设置我可以卖出的最低价格。
##COST
SELECT value AS cost from catalog_product_entity_decimal
where attribute_id = 79 and
entity_id IN (select product_id from catalog_category_product)
##LOWEST
SELECT value AS lowest from catalog_product_entity_decimal
where attribute_id = 164 and
entity_id IN (select product_id from catalog_category_product)
update catalog_product_entity_decimal
set value = (cost+3.5)/.84
where attribute_id = 164 and
entity_id IN (select product_id from catalog_category_product);
我该怎么做呢?至少可以说我是 MySQL 新手。
我尝试过 UNION 和 Multiple Selects,但我想我做错了。
【问题讨论】: