--删除表 TableName 中字段 A、B、C 同时重复的数据,并保留一条
DELETE FROM dbo.TableName WHERE Id IN(
--根据A,B,C三个字段查询出重复的数据
SELECT * FROM
(
SELECT *,OrderNo=ROW_NUMBER() OVER(PARTITION BY A,B,C ORDER BY GETDATE())
FROM dbo.TableName
) Tmp
WHERE OrderNo>1
);
--删除表 TableName 中字段 A、B、C 同时重复的数据,并保留一条
DELETE FROM dbo.TableName WHERE Id IN(
--根据A,B,C三个字段查询出重复的数据
SELECT * FROM
(
SELECT *,OrderNo=ROW_NUMBER() OVER(PARTITION BY A,B,C ORDER BY GETDATE())
FROM dbo.TableName
) Tmp
WHERE OrderNo>1
);