2

好的,我有两个表 Clients 和 Quotes 这两个表都有一个 EnqNo 列。客户有两个空列项目、报价。Quotes 有两列 Project 和 Estimate。我需要用项目更新客户,并从 EnqNo 匹配的报价中估计字段。因此 Quote in Clients 从 Quotes 中为每一行获取估计值。说得通?

我正在努力让查询工作:

update Clients
set Clients.Project = Quotes.Project
from Clients, Quotes
where Quotes.EnqNo = Clients.EnqNo
4

2 回答 2

4

SQL 服务器:

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
于 2013-11-13T13:55:35.573 回答
1

这是MySQL.

UPDATE Clients 
       INNER JOIN Quotes 
          ON Quotes.EnqNo = Clients.EnqNo
SET    Clients.Project = Quotes.Project
于 2013-11-13T13:54:36.637 回答