我需要将已安装的产品表中的cust设置为Customers表中的ID,尝试了一些没有运气的语句;只需指向正确的方向。
这就是我所拥有的:
UPDATE InstalledProducts
SET InstalledProducts.cust = Customers.ID
FROM InstalledProducts, Customers
WHERE InstalledProducts.SiteName = Customers.SiteName
非常感谢任何帮助。感谢
答案 0 :(得分:1)
JOIN的更新语句应为
update
InstalledProducts ip
join Customers c on c.SiteName = ip.SiteName
set ip.cust = c.ID
答案 1 :(得分:1)
这是我怎么写的:
UPDATE InstalledProducts ip
SET cust =
(SELECT ID FROM Customers
WHERE ip.SiteName = SiteName)