有如下表
a     b      c
98.5  93.2   99.2
99.6  94.6   96.3
99.3  98.5   95.3
95.4  92.1   91.2
98.5   94.3   94.5
求以上表中,统计出以下区间出现的各数
如:91.5-93
    93.5-95
    95.5-98
    98-100请高手指点

解决方案 »

  1.   

    有如下表
    a b c
    98.5 93.2 99.2
    99.6 94.6 96.3
    99.3 98.5 95.3
    95.4 92.1 91.2
    98.5 94.3 94.5
    这个是什么啊,
    select count(*) from biao where zhi > 91 and zhi < 98 这都能满足需求了。
      

  2.   

    什么意思  你是一个表里面有三个字段( a,b,c )么 还是有三个表(a,b,c)呀,a b c
    98.5 93.2 99.2
    99.6 94.6 96.3
    99.3 98.5 95.3
    95.4 92.1 91.2
    98.5 94.3 94.5这个又是什么东西。需求不明确。
      

  3.   

    a ,b,c 是一个表中的三个列,我这里只是举例子,实际可能列比这多呢
      

  4.   


    select sum(case when a>91.5 and a<93 then 1 else 0 end) "91.5-93",
           sum(case when a>93.5 and a<95 then 1 else 0 end) "93.5-95",
           sum(case when a>95.5 and a<98 then 1 else 0 end) "95.5-98",
           sum(case when a>98 and a<100 then 1 else 0 end)  "98-100"
    from tablename
    union all
    select sum(case when b>91.5 and b<93 then 1 else 0 end) ,
           sum(case when b>93.5 and b<95 then 1 else 0 end) ,
           sum(case when b>95.5 and b<98 then 1 else 0 end) ,
           sum(case when b>98 and b<100 then 1 else 0 end) 
    from tablename
    union all
    .....