Oracle多字段统计大于某值的sql写法

合在一起的写法

select (select count(h2s) from T_RECEIVE_DATA where h2s>0 ) as h2s,(select count(stench) from T_RECEIVE_DATA where stench>0 )  as stench ,(select count(nh3) from T_RECEIVE_DATA where nh3>0 )   as nh3  from  dual

分开三个写法
select count(h2s) as h2s from T_RECEIVE_DATA where h2s>0 

select count(stench)  as stench from T_RECEIVE_DATA where stench>0 

select count(nh3)  as nh3  from T_RECEIVE_DATA where nh3>0

相关文章: