T-SQL 刪除重複資料SQL

DukeCheng發表於2014-03-07

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

相關文章