除非伴随 WHERE... IS NULL,否则 UPDATE 查询中的 OUTER JOIN 极为罕见。你确定那是你想要的吗?
除此之外,这个查询没有任何问题......
DROP TABLE IF EXISTS accounts;
CREATE TABLE accounts(id INT NOT NULL PRIMARY KEY,billing_address_county VARCHAR(40) NOT NULL);
DROP TABLE IF EXISTS accounts_old;
CREATE TABLE accounts_old(id INT NOT NULL PRIMARY KEY,billing_address_county VARCHAR(40) NOT NULL);
INSERT INTO accounts VALUES (1,'Hale County');
INSERT INTO accounts VALUES (2,'Perry County');
INSERT INTO accounts_old VALUES (1,'Hale County');
INSERT INTO accounts_old VALUES (2,'Tuscaloosa County');
UPDATE accounts new
JOIN accounts_old old
ON old.id = new.id
SET new.billing_address_county = old.billing_address_county;
Query OK, 1 row affected (0.01 sec)
Rows matched: 2 Changed: 1 Warnings: 0
mysql> SELECT * FROM accounts;
+----+------------------------+
| id | billing_address_county |
+----+------------------------+
| 1 | Hale County |
| 2 | Tuscaloosa County |
+----+------------------------+
2 rows in set (0.00 sec)
mysql>