declare @t table
(ID int,a varchar(20),b varchar(20))insert @tselect 1,'aaa','dsd' union all
select 2,'aaa','dsada' union all
select 3,'aaa','fdfdsfs' union all
select 4,'bb','wqeqwe' union all
select 5,'hhh','ewqed' union all
select 6,'hhh','ewqe' union all
select 7,'uu','ewqe'select * from @t a
where not exists (select * from @t b where a.a=b.a and a.id>b.id)ID          a                    b                    
----------- -------------------- -------------------- 
1           aaa                  dsd
4           bb                   wqeqwe
5           hhh                  ewqed
7           uu                   ewqe(所影响的行数为 4 行)