T-SQL 删除重复数据SQL
WITH cte AS (
SELECT roleid,permissionid,
row_number() OVER(PARTITION BY roleid,permissionid ORDER BY roleid,permissionid) AS [rn]
FROM rolepermissionrecords
)
DELETE cte WHERE [rn] > 1
WITH cte AS (
SELECT roleid,permissionid,
row_number() OVER(PARTITION BY roleid,permissionid ORDER BY roleid,permissionid) AS [rn]
FROM rolepermissionrecords
)
DELETE cte WHERE [rn] > 1