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

posted @ 2014-03-07 12:29  DukeCheng  阅读(175)  评论(0编辑  收藏  举报