使用来自另一个表的值更新表-MySQL

时间:2019-10-16 10:30:33

标签: mysql sql

我有一个客户帐户和客户表,客户col可以将它们链接起来,并获得日期col到客户表中。

帐户表

enter image description here

客户表

enter image description here

决赛桌

enter image description here

如果我使用以下查询,则表示正在跟踪错误

  

错误:用作查询的子查询返回的一行以上

我在做什么错了?

UPDATE account
SET date = (
SELECT date
FROM customer
WHERE customer.customer = account.customer
);

1 个答案:

答案 0 :(得分:1)

考虑update ... join ... set语法:

update account a
inner join customer c on a.customer = c.custom
set a.date = c.date
相关问题