本帖最后由 pely122 于 2011-09-27 17:11:23 编辑

解决方案 »

  1.   

    select max(c) from table group by a;
      

  2.   

    如果要查询所有字段则使用下面的sql
    select * from table where (a,c) in (select a,max(c) from table group by a);
      

  3.   

    select t.* from tb t where not exists(select 1 from tb where a = t.a and c > t.c) order by t.aselect t.* from tb t where c = (select max(c) from tb where a = t.a) order by t.a
      

  4.   

    select max(c) from table group by a;
      

  5.   

    select a, b, max(c)
    from tb_name
    group by a, b
    order by a, b;
      

  6.   

    select * from(
    select a,b,c,row_number()over(partition by a order by b desc,c desc) rn from tab
    ) where rn=1
      

  7.   

    select t.* from tb t where c = (select max(c) from tb where a = t.a) order by t.a
      

  8.   

    你是不是想按照A来进行分类再获取其中最大的值?如果是的话语句应该是这样的:SELECT A,MAX(C) FROM 表 GROUP BY A