请你用Count(bm),不要用count(*);
select bm,count(bm) from tablename group by bm;

解决方案 »

  1.   

    freddy2003()大哥的结果和(a)一样呀,帮帮忙,急
      

  2.   

    如果你统计结果如(a)所示,那bm根本不可能有'01','03'等值
    你这样验证一下:
    select distinct bm from tablename;
    看结果是否有'01', '02'等值
      

  3.   

    SQL> select * from seq_no;ID1
    ---
    1
    2
    3
    4
    SQL> select * from test_t;ID1 NAME       AAA
    --- ---------- ----------
    1   占三       
    2   李斯       
    1   网无       
    4   赵单       
    2   司机       
    1   占三       
    2   李斯       
    1   网无       
    4   赵单       
    2   司机       
    SQL> select a.id1,count(b.id1) from seq_no a,test_t b where a.id1=b.id1(+) group by a.id1;ID1 COUNT(B.ID1)
    --- ------------
    1              4
    2              4
    3              0
    4              2
      

  4.   

    select rm bm,count(1) from tablename a,(select rownum rm from user_objects where rownum<=21) b where a.bm(+)=b.rm group by b.rm
      

  5.   

    Lisbi () 
    你说的那种情况更本不可能出现,
    你应该是两张表或更多表关联才会有你说的那种情况如果是表关联,用外联就可以了
      

  6.   

    select bm,nvl(count(*),0) from tablename group by bm