1

这实际上使我的 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;
4

1 回答 1

2

您不能从一个语句更新多个表。您可以将多个表输入到单个 SQLUPDATE语句中,例如 a 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;

ETC...

这是一个与此相关的好线程:如何在 SQL Server 2005 的一条语句中更新两个表?

于 2012-11-14T13:47:41.430 回答