尝试设置简单查询以将任何“0”更新为“1”时,我收到以下错误消息。
第15行,第1行,第6行 关键字'UPDATE'附近的语法不正确。
第15行,第15行,第1行,第17行 关键字“AS”附近的语法不正确。
SELECT *
FROM
UPDATE Table Policies_with_claims
SET Policies_with_claims.Claim_Count=1
FROM
(
SELECT DISTINCT [Sheenal_Policy_Data].[PolicyIdentifier],
COUNT([Sheenal_Claims_Data].[PolicyIdentifier]) AS Claim_Count
FROM (
[Medical Malpractice].[dbo].[Sheenal Policy Data] AS Sheenal_Policy_Data
LEFT JOIN [Medical Malpractice].[dbo].[Sheenal Claims Data] AS Sheenal_Claims_Data ON
(Sheenal_Policy_Data.PolicyIdentifier = Sheenal_Claims_Data.PolicyIdentifier)
)
GROUP BY [Sheenal_Policy_Data].[PolicyIdentifier]
) AS Policies_with_Claims
WHERE Policies_with_claims.Claim_Count=0