统计sql 语句 

sql 语句

sql 语句 

select e.*,
round(( decode(e.bjzs,0,0,bjzs/e.zs))*100,2) || '%'  as bjl ,
round(( decode(e.bjcq,0,0,bjcq/e.zs))*100,2) || '%'  as bjcql,
round(( decode(e.zbcq,0,0,zbcq/e.zs))*100,2) || '%'  as zbcql,
round(( decode(e.gqcq,0,0,gqcq/e.zs))*100,2) || '%'  as gqcql  from (
select blks,ywlx,
count(*) as zs, 
count( case when t.lczt in ('1') then '1' end ) zbzs,  
count( case when t.lczt in ('1') and t.sxzt in ('1') then '1' end ) zbzc, 
count( case when t.lczt in ('1') and t.sxzt in ('3') then '1' end ) zbcq, 
count( case when t.lczt  in ('2') then '2' end ) bjzs ,
count( case when t.lczt in ('2') and t.sxzt in ('1') then '1' end ) bjzc, 
count( case when t.lczt in ('2') and t.sxzt in ('3') then '1' end ) bjcq, 
count( case when  t.rwzt in ('13') then '13' end ) as gqzs ,
count( case when t.lczt in ('13') and t.sxzt in ('1') then '1' end ) as gqzc, 
count( case when t.lczt in ('13') and t.sxzt in ('3') then '1' end ) as gqcq 
 from up_hzjg_accept_jt01 t {} group by ywlx,blks) e

相关文章: