来求出C字段的COUNT 什么意思?
根据A,B组合来分组,下面就可以了
select A,B,count(1) 
  from table
  group by A,B

解决方案 »

  1.   

    比如说
     A    B    C(比如是分数)
     a1   b1    1
     a1   b2    1
     a2   b2    1
     a2   b2    1
     a2   b1    1
     a2   b1    1
    想统计出:
     A    B    C(合计)
     a1   b1    1
     a1   b2    1
     a2   b1    2
     a2   b2    2
      

  2.   

    select count(rowid) from table group by a,b;
      

  3.   

    select A,B,count(C) C from table group by A,B;
      

  4.   

    select a,b,sum(c) from table group by a,b
      

  5.   

    如果计算记录数,用count()
    如果求和,用sum()