select * from tab a
where not exists(select 1 from tab b where a.a=b.a and a.id<b.id)
order by a.id desc

解决方案 »

  1.   


    drop table tb1 
    create table tb1(ID int,A int,B varchar(20),C varchar(20))
    insert into tb1
    select 1,11,'TT','EE' union all
    select 2,22,'II','KK' union all
    select 3,11,'OO','55' union all
    select 4,33,'56','35' union all
    select 5,22,'89','FD' select * from tb1 a where ID=(select max(ID) from tb1 where A=a.A)
    order by ID DESC