这实际上让我的phpmyadmin停止工作。
SET @admin_mail = "mail@mail.com";
-- 5. SET ORDER MAIL
UPDATE
sales_flat_order,
sales_flat_order_address,
-- sales_flat_order_status_history,
sales_flat_quote,
sales_flat_quote_address
SET
sales_flat_order.customer_email = @admin_mail,
sales_flat_order_address.email = @admin_mail,
sales_flat_quote.customer_email = @admin_mail,
sales_flat_quote_address.email = @admin_mail;
答案 0 :(得分:2)
您无法从一个语句更新多个表。您可以将多个表输入到单个SQL UPDATE
语句中,如JOIN
,但您实际上只能更新其中一个表中的值。
你必须这样做:
UPDATE
sales_flat_order
SET
sales_flat_order.customer_email = @admin_mail;
UPDATE
sales_flat_order_address
SET
sales_flat_order_address.email = @admin_mail;
等...
这是一个与此相关的好线程:How to update two tables in one statement in SQL Server 2005?