对想要去除重复的列使用 group by 函数即可。可以使用:select * from test group by tel;这是最简单的一种情况,用关键字distinct就可以去掉example: select distinct * from table(表名) where (条件) CREATE TABLE 临时表 AS (select distinct * from 表名); drop table 正式表; insert into 正式表 (select * from 临时表); drop table 临时表;
#测试环境:sql server 20081、sql:1234567withbaseas( select * ,ROW_NUMBER() over(partition by name order by id) as rowIndex from users)select id,trim(name)+trim(CAST( rowIndex as varchar)) as name from base2、结果: