我刚写oracle  为什么我用PL\SQL developer的时候
当我跑像 select case when a = '1' then 'A' else then 'B' end ,count(*) from tablename
group by case when a = '1' then 'A' else then 'B' end 这种语句的时候 如果count(*)没有数量的时候为什么不显示出来呢怎么样才能显示出来谢谢

解决方案 »

  1.   

    在Oracle 选择判断 用decode()
      

  2.   

    select decode(a,'1','A','B'),count(*) from tablename group by decode(a,'1','A','B')
      

  3.   

    比如 有张表
    A   B
    ------ 
    4 d
    3 w
    4 a
    我怎样才能显示
    3   1
    4   2
    5   0
      

  4.   

    select case when a = '1' then 'A' else then 'B' end ,nvl(count(*), 0) from tablename
    group by case when a = '1' then 'A' else then 'B' end
      

  5.   

    select Col3,nvl(B.col2,0) from table2, 
    (select A Col1,count(1) Col2 from table1 group by A) B
    where table2=B.col1(+)