好的我有两个表客户端和引号两个表都有一个EnqNo列。客户端有两个空列Project,Quote。行情有两列Project和Estimate。我需要使用项目更新客户端并估计EnqNo匹配的引号中的字段。因此,客户中的报价从每行的报价中获取估计值。有意义吗?
我正在努力让查询工作:
update Clients
set Clients.Project = Quotes.Project
from Clients, Quotes
where Quotes.EnqNo = Clients.EnqNo
答案 0 :(得分:3)
SQL Server:
UPDATE Clients
SET Project = q.Project
FROM Clients c
JOIN Quotes q ON q.EnqNo = c.EnqNo
MySQL的:
UPDATE Clients c
JOIN Quotes q ON q.EnqNo = c.EnqNo
SET c.Project = q.Project
答案 1 :(得分:1)
以下是MySQL
的更新声明。
UPDATE Clients
INNER JOIN Quotes
ON Quotes.EnqNo = Clients.EnqNo
SET Clients.Project = Quotes.Project