oracle 查询表中所有行数 并查询某一字段大于零的行数   在一条sql语句中显示

解决方案 »

  1.   

    select * from tablename where 字段>0 不就可以了么 
      

  2.   


    --楼主应该这个意思吧
    select count(1),  -- all rows count
      (select count(1) from tab where col >0)  -- rows count with col>0
    from tab;
      

  3.   


    select count(1),  -- all rows count
      sum(case when col >0 then 1 else 0 end)  -- rows count with col>0
    from tab;
      

  4.   


    --这样就行了
    select count(1),sum(case when 列>0 then 1 else 0 end) from 表
      

  5.   

    select sum(*),sum(case when id > 0 then 1 else 0 end) from table;
      

  6.   

    select count(*),sum(case when id > 0 then 1 else 0 end) from table;
    更正下,应该是这个
      

  7.   

    select count(1),sum(case when id > 0 then 1 else 0 end) from table;