访问更新查询

时间:2014-04-22 15:04:32

标签: sql ms-access updates

UPDATE dbo_enrollment AS A INNER JOIN Get_New_PCP AS B 
ON A.PartD_ID = B.PartD_ID SET A.Nbr = B.['UpdatePCP'];

所以Get_New_PCP是我运行的一个查询,用于从数据库中获取最新导入文件的所有更改值。

我得到的错误是我Operation must use an updateable query ...

非常熟悉SQL和Access - 我实际上可能遇到过这个问题,有没有办法解决它而不用查询结果表? 我认为它会像一个视图...我试图研究它,但在我的搜索中访问UPDATE QUERY只返回一堆更新查询语法......

非常感谢任何帮助。

谢谢!

更新

SELECT 
c.MaxLoadDate, 
a.CMS_Status_Update_Date, 
a.Effective_Date, 
a.PBP_Nbr, 
a.Unique_Member_ID AS EnrolleeID, 
a.First_Name+', '+a.Surname AS Enrollee, 
a.Street_Address1, a.Street_Address2, 
a.City, 
a.State, 
a.Zip, 
a.Birth_Date AS DOB, 
"(" & Left(d.[Phone],3) & ")" & Mid(d.[Phone],4,3) & "-" & Mid(d.[Phone],5,4) AS PCP_PhoneNumber, 
a.HIN, 
a.PartD_ID, 
b.[Eff Date], 
b.[PID] AS ['UpdatePCP'], 
a.PCP_Nbr AS ['CurrentPCP'], 
IIf(c.PartD_LIPSL Is Null,'W/o LIS','LIS') AS LISStatus
FROM ((dbo_enrollment AS a INNER JOIN cards_april2014 AS b 
ON a.PartD_ID = b.RecNum) 
LEFT JOIN 
GetMaxDateForLISUpdate AS c ON a.HIN = c.HIN) 
LEFT JOIN [CCAPM2] AS d 
ON a.PCP_Nbr = d.PID
WHERE (((a.PCP_Nbr)<>b.[PID]) And ((a.CMS_Status)='Enrolled'))
DESC;

1 个答案:

答案 0 :(得分:0)

我猜测加入Get_New_PCP查询的GetMaxDateForLISUpdate查询是个问题。无法更新涉及聚合的查询。请查看here以了解有关解决此问题的选项。