如果要保留重复组中的一行,可以使用
ROW_NUMBER。在这个例子中,我保持最低的行
Id:
WITH CTE AS ( SELECt rn = ROW_NUMBER() OVER( PARTITION BY employeeid, dateofincident, typeid, description ORDER BY Id ASC), * FROM dbo.TableName) DELETe FROM cte WHERe rn > 1
欢迎分享,转载请注明来源:内存溢出
如果要保留重复组中的一行,可以使用
ROW_NUMBER。在这个例子中,我保持最低的行
Id:
WITH CTE AS ( SELECt rn = ROW_NUMBER() OVER( PARTITION BY employeeid, dateofincident, typeid, description ORDER BY Id ASC), * FROM dbo.TableName) DELETe FROM cte WHERe rn > 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)