select a.id,a.name,a.order from test a,(select max(order) as max_order,id from test group by id) b where a.id = b.id and a.order = b.max_order;

解决方案 »

  1.   

    select id,name,"order" from
    (
      select id,name,"order",rank() over(partition by id order by "order" desc) rn from test
    )
    where rn=1
      

  2.   

    楼主这句已经很好了,要想优化提高效率可以在索引等上研究如在id ,order上建索引。如果楼主能保证order列是严格按分组排序的那么也可以用下面这句select a.* from test a,(select max(rowid) no from text group by "ORDER") b where a.rowid=b.no;
      

  3.   

    ORARichard(没钱的日子好难过啊) 都说清楚了!
      

  4.   

    select id, max(order) 
    from test
    group by id
    order by id;