select sum(decode(class,'01',1,0)),sum(decode(class,'02',1,0)),sum(decode(class,'03',1,0))
from mytab where class in ('01','02','03');

解决方案 »

  1.   

    select cnt1,cnt2,cnt3
    from 
    (select count(*) cnt1 from mytab where class='01') a,
    (select count(*) cnt2 from mytab where class='02') b,
    (select count(*) cnt3 from mytab where class='03') c
    ;
      

  2.   

    select count(case class when '01' then class else null end) as class01,
           count(case class when '02' then class else null end) as class02,
           count(case class when '03' then class else null end) as class03
    from mytab