请教!
TABLE A
A     B     C    D
1     1     1    1
1     1     2    2 
1     2     4    2  
1     2     2    3
1     2     3    4
 
SELECT * FROM A  GROUP BY A,B
结果是什么?
怎么写SQL才能同时得到A=1,B=1 中C 的个数?可以看出来C的个数为2,这2怎么得到
在线等... 

解决方案 »

  1.   

    你什么意思?
    你的数据group by a,b
    SELECT * FROM A  GROUP BY A,B//你这句执行不起来的
    select a,b,count(case when a=1 and b=1 then c else null end) 
    from table group by a,b
      

  2.   

    select count(*) from (
                          select c_a,c_b,c_c
                            from table_name
                           where 1 = 1
                           group by c_a,c_b,c_c
                          );