--构造原始数据 CREATE TABLE #T(N VARCHAR(10)) --插入数据 INSERT INTO #T (N)VALUES ('A') --方式一:一句话删除重复数据(无主键) DELETE t FROM (SELECT *, ROW_NUMBER() OVER(ORDER BY N) AS rownum FROM #t ) AS t WHERE t.rownum > 1 --方式二:采用CTQ,with的写法删除 ;WITH T AS ( SELECT *, ROW_NUMBER() OVER(ORDER BY N) AS rownum FROM #t ) DELETE FROM T WHERE T.rownum > 1