且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用MS Access如何执行具有多个联接和where子句的更新?

更新时间:2023-10-23 16:25:22

我确实在MS论坛上得到了某人的帮助.解决的办法是格式化我的SQL稍有不同.这是最终起作用的代码.

I did get some help from someone over at the MS forums. The solution was to format my SQL slightly differently. Here is the code that eventually worked.

UPDATE 
(
 (
   by15official LEFT JOIN investmentinfo 
   ON by15official.InvestmentNumber = investmentInfo.investID 
 )
 LEFT JOIN 
 fundingSources 
 ON investmentInfo.id = fundingSources.investId 
) 
LEFT JOIN budgetInfo 
ON fundingSources.id = budgetInfo.fundingID

SET investmentInfo.investmentType = by15official.InvestmentNumber

WHERE (investmentinfo.submissionType = 2)
And (budgetInfo.byYear = 2015)  

也许上述Access SQL可以帮助其他人.

Perhaps the above Access SQL can help others.

基本上,您想在执行set和where子句之前进行更新和联接.是有道理的,而且我敢肯定,如果我会更熟练地编写SQL,我会知道的.

Basically you want to do the update and the joins before doing the set and where clauses. Makes sense, and I am sure if I were better skilled at writing SQL I would have known that.