当我运行此 SQL 代码时,我收到以下错误消息:
Msg 116, Level 16, State 1, Line 17
Only one expression can be specified in the select list when the subquery
is not introduced with EXISTS.
我想要的是,每当从具有相同的更新查询中返回任何内容时,它都会使用of + 1AgreementNo, ElementStartDate and DateSeqNo
更新这些重复记录之一,这将删除重复项。ElementStartDate
Update [WASP_Mart_EmbassyActuarial].[dbo].[tblARM_OmegaSource]
SET ElementStartDate = ElementStartDate + 1
WHERE AgreementNo IN
(SELECT
count(*) as [Count],
[AgreementNo],
[ElementStartDate],
[DateSeqNo],
getdate() as Today
FROM [WASP_Mart_EmbassyActuarial].[dbo].[tblARM_OmegaSource]
GROUP BY
[AgreementNo],
[ElementStartDate],
[DateSeqNo]
HAVING COUNT(*) = 2)