过滤重复记录

表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

posted @ 2008-03-28 10:48  BigRain  阅读(270)  评论(0编辑  收藏  举报