select * from  table where aa in(select max(aa) from table group by id);

解决方案 »

  1.   

    如果有Other的话就复杂一点
    select * 
    from table a,
    (select id,max(aa) aa 
    from table
    group by id) b
    where a.id=b.id
    and a.aa=b.aa
      

  2.   

    WITH Y (
    select distinct  id,max(aa) over (partition by id) aa 
    from table
    )
    select * from table inner join Y on table.id = y.id and table.aa = y.aa
      

  3.   

    select id ,aa ,other from (
    select id ,aa, other, rank()over(partition by id order by aa desc) rank_aa
    from test )
    where rank_aa = 1;
      

  4.   

    用我的方法和xiaoxiao1984(潇潇) 的都完全满足你需要的结果.