我不是phpMyAdmin大师所以我想你可能很容易。
在Magento数据库上我需要
update sales_flat_order volumn customer_group_id
where the customer_group_id = 0
我想让它更新另一个表中的值:
从表customer_entity
获取,列名为group_id
所以总之我想这样做:
UPDATE sales_flat_order column "customer_group_id" where "customer_group_id" = 0
且customer_group_id
的新值应来自customer_entity
字段group_id
。
在phpmyadmin SQL中输入什么内容?
我的想法,这会有用吗?
UPDATE sales_flat_order WHERE customer_group_id=0
SET sales_flat_order.customer_group_id=(SELECT customer_entity.group_id
FROM customer_entity
WHERE customer_entity.entity_id=sales_flat_order.customer_id);
答案 0 :(得分:1)
您需要使用join
并更新为
update sales_flat_order sfo
join customer_entity ce on ce.entity_id = sfo.customer_id
set sfo.customer_group_id = ce.group_id
where sfo.customer_group_id=0