统计函数实例

经转局邮件及时处理率  -> 报表文件:mailMidHandleStat.rptdesign -> sql:
  select '' SUM_DATE,td.province,sd.district_name,td.dept_code,td.dept_name,s.*
  from ( select dept_code,sum(need_rcv_cnt) need_rcv_cnt,sum(rcv_cnt) rcv_cnt,sum(handle_cnt)  handle_cnt
,sum(cnt_12) cnt_12,sum(cnt_24) cnt_24,sum(cnt_36) cnt_36,sum(cnt_48) cnt_48
,sum(cnt_over_48) cnt_over_48,sum(open_cnt) open_cnt,sum(seal_cnt) seal_cnt
  from SUM_MAIL_MID_HANDLE_STAT where  sum_date>='20140701' and sum_date<='20140701' group by
dept_code) s,tb_dept td,sys_district sd
  where s.dept_code=td.dept_code(+) and td.province=sd.district_code(+)
AND td.ANCESTOR LIKE ('%' || LPAD('100', 10, '0') || '%')
order by td.country


48h以上

经转局邮件及时处理率  -> 报表文件:mailMidHandleStat.rptdesign -> sql:
  select '' SUM_DATE,td.province,sd.district_name,td.dept_code,td.dept_name,s.*
  from ( select dept_code,sum(need_rcv_cnt) need_rcv_cnt,sum(rcv_cnt) rcv_cnt,sum(handle_cnt)  handle_cnt
,sum(cnt_12) cnt_12,sum(cnt_24) cnt_24,sum(cnt_36) cnt_36,sum(cnt_48) cnt_48
,sum(cnt_over_48) cnt_over_48,sum(open_cnt) open_cnt,sum(seal_cnt) seal_cnt
  from SUM_MAIL_MID_HANDLE_STAT where  sum_date>='20140701' and sum_date<='20140701' group by
dept_code) s,tb_dept td,sys_district sd
  where s.dept_code=td.dept_code(+) and td.province=sd.district_code(+)
AND td.ANCESTOR LIKE ('%' || LPAD('100', 10, '0') || '%')
order by td.country


36h

select mi.mail_num,mi.rcv_province_code,d.dept_name,mi.clct_org,f.DISTRICT_NAME as country,
to_char(mi.clct_time,'yyyy-MM-dd hh24:mi:ss') clct_time,to_char(mi.clct_send_time,'yyyy-MM-dd hh24:mi:ss') clct_send_time,
to_char(mi.mid_open_time,'yyyy-MM-dd hh24:mi:ss') mid_open_time,to_char(mi.mid_seal_time,'yyyy-MM-dd hh24:mi:ss') mid_send_time,
round((mi.mid_seal_time - mi.mid_open_time ) * 24, 1) diff_time
from fact_mail_info mi, v_dlv_district f, tb_dept d
where mi.rcv_province_code=f.DISTRICT_CODE(+) and mi.clct_org=d.dept_id(+)
and mi.mid_org = '20110600'
and mi.MID_SEAL_TIME is not null and mi.MID_SEAL_TIME - mi.MID_OPEN_TIME <= 1.5
and mi.clct_sum_date>='20140601' and mi.clct_sum_date<='20140601'

你可能感兴趣的:(统计函数)