过滤重复记录

表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

你可能感兴趣的:(过滤)