过滤重复记录

表lin(a, b, c)


select *, px = identity(int, 1, 1) into #tb
from lin
go

select *
from #tb as t1
where not exists(
                  select 1
                  from #tb as t2
                  where t1.a = t2.a and t2.px < t1.px)

go
drop table #tb

原文地址:https://www.cnblogs.com/Linjianyu/p/1097251.html