select distinct * from table(表名) where (条件)
select * from table where id in (select max(id) from table group by [去除重复的字段名列表,....])
select identity(int,1,1) as id,* into newtable(临时表) from table
select * from newtable where id in (select max(id) from newtable group by [去除重复的字段名列表,....])
drop table newtable
原文:https://www.cnblogs.com/wy0726/p/15080879.html