请告诉我如何以块的形式运行查询。我在尝试删除基于MyKey的重复记录。如何调整这个"
WITH cte AS
( SELECT [ID] ,[F2] ,[F3] ,[F8] ,[F14] ,[F29] ,[F31] ,[F43] ,[F44] ,[F45] ,[F46] ,[F47] ,[F48] ,[F49] ,[F50] ,[F52] ,[F53] ,[F54] ,[F55] ,[F56] ,[F57] ,[F58] ,[F59] ,[F63] , row_number()
OVER(PARTITION BY MyKey ORDER BY MyKey
)
AS [rn]
FROM [myDB].[dbo].[myTable]
)
DELETE cte WHERE [rn] > 1
"
答案 0 :(得分:1)
您不希望最终查询为:
DELETE cte WHERE [rn] > 1 and rn < 5000
您是否还需要帮助编写while
循环?