首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > Java > 领导汇报_数据统计_sql.txt
【标  题】:领导汇报_数据统计_sql.txt
【关键字】:_sql.txt
【来  源】:http://blog.csdn.net/ydsakyclguozi/archive/2007/04/19/1570198.aspx

领导汇报_数据统计_sql.txt

1:  统计迁钢公司运行结束流程
     select count(*)  from inst_process a where state='4'
      and started>to_date('2007-02-24','yyyy-MM-dd')

2: 迁钢公司正在运行的流程
      select count(*)  from inst_process a where state='3'
      and started>to_date('2007-02-24','yyyy-MM-dd')

3:  迁钢公司结束流程,按照流程汇总查询
    
     select count(*),name  from inst_process
     where state='4'
     and started>to_date('2007-02-24','yyyy-MM-dd')
     group by name

3:  迁钢公司运行流程,按照流程汇总查询

      select count(*),name  from inst_process
      where state='3'
      and started>to_date('2007-02-24','yyyy-MM-dd')
      group by name

4:  迁钢公司拟搞人,拟搞结束流程数查询

     select count(*) num,initiator,b.name
 from inst_process a,
  orgmodel_userinfo b
 where
 state='4'
       and started>to_date('2007-02-24','yyyy-MM-dd')
 and a.initiator = b.id
 group by initiator,b.name
 order by num

5:  迁钢公司拟搞人,拟搞运行流程数查询

     select count(*) num,initiator,b.name
 from inst_process a,
  orgmodel_userinfo b
 where
 state='3'
       and started>to_date('2007-02-24','yyyy-MM-dd')
 and a.initiator = b.id
 group by initiator,b.name
 order by num

6:  部门结束流程汇总查询

      select
  sum(num),
  g.parentid,
  h.name
  from
  (
    select count(*) num,initiator,b.name,c.orgid
    from inst_process a,
     orgmodel_userinfo b,
     orgmodel_usertoorg c
    where
    state='4'
          and started>to_date('2007-02-24','yyyy-MM-dd')
    and a.initiator = b.id
    and b.id = c.userid and c.isprimary='1'
    group by initiator,b.name,c.orgid
    order by num
 ) e,orgmodel_orginfo f,orgmodel_orgtoorg g,orgmodel_orginfo h
 where e.orgid=f.id and f.id=g.childid
       and g.parentid=h.id
 group  by g.parentid,h.name


 7:  部门运行流程汇总查询

      select
  sum(num),
  g.parentid,
  h.name
  from
  (
    select count(*) num,initiator,b.name,c.orgid
    from inst_process a,
     orgmodel_userinfo b,
     orgmodel_usertoorg c
    where
    state='3'
          and started>to_date('2007-02-24','yyyy-MM-dd')
    and a.initiator = b.id
    and b.id = c.userid and c.isprimary='1'
    group by initiator,b.name,c.orgid
    order by num
 ) e,orgmodel_orginfo f,orgmodel_orgtoorg g,orgmodel_orginfo h
 where e.orgid=f.id and f.id=g.childid
       and g.parentid=h.id
 group  by g.parentid,h.name


 8: 结束流程处理查询
 
 select (completed-started) worktime, a.* from inst_process a

 where state='4'
           and started>to_date('2007-02-24','yyyy-MM-dd')
 order by worktime desc

 
 9: 流程平均处理时间

     select
     sum(worktime)/count(*)
     from
     (select
       (completed - started) worktime,
       a. *
     from inst_process a
     where state = '4'
           and started > to_date('2007-02-24', 'yyyy-MM-dd')
     order by worktime desc
     ) a

 
 9: 流程分类平均处理时间

 select
 sum(worktime)/count(*),
        name
        from
        (select
         (completed - started) worktime,
         a. *
         from inst_process a
         where state = '4'
           and started > to_date('2007-02-24', 'yyyy-MM-dd')
        order by worktime desc
        ) a
       group by name


 10:流程最快处理时间

     参靠8

 11:流程最慢处理时间
   
     参靠8

 

select
  sum(e.maxworktime)/count(*),
  g.parentid,
  h.name
  from
  (
    select min(completed-started) minworktime, max(completed-started) maxworktime,initiator,b.name,c.orgid
    from inst_process a,
     orgmodel_userinfo b,
     orgmodel_usertoorg c
    where
    state='4'
          and started>to_date('2007-02-24','yyyy-MM-dd')
    and a.initiator = b.id
    and b.id = c.userid and c.isprimary='1'
    group by initiator,b.name,c.orgid
  
 ) e,orgmodel_orginfo f,orgmodel_orgtoorg g,orgmodel_orginfo h
 where e.orgid=f.id and f.id=g.childid
       and g.parentid=h.id
 group  by g.parentid,h.name


select
  sum(e.minworktime)/count(*),
  max(e.minworktime),
  g.parentid,
  h.name
  from
  (
    select (completed-started) minworktime,initiator,b.name,c.orgid
    from inst_process a,
     orgmodel_userinfo b,
     orgmodel_usertoorg c
    where
    state='4'
          and started>to_date('2007-02-24','yyyy-MM-dd')
    and a.initiator = b.id
    and b.id = c.userid and c.isprimary='1'
    --group by initiator,b.name,c.orgid
  
 ) e,orgmodel_orginfo f,orgmodel_orgtoorg g,orgmodel_orginfo h
 where e.orgid=f.id and f.id=g.childid
       and g.parentid=h.id
 group  by g.parentid,h.name

 

13.所有流程的流程节点经过部门的平均时间
select
 sum(worktime)/count(*),
 count(*),
 g.name
 --funname
 from 
(
  select
  e.*,
  DECODE(trim(f.parentid),'00000001',f.childid,f.parentid) pp
  --f.parentid pp
  from
  (
    select a.name funname, b.userid, (b.taskendtime - b.taskreceivetime) worktime,c.orgid
    from inst_process a, oa_tasklist b, orgmodel_usertoorg c
    where state = 4
    and a.started>to_date('2007-02-24','yyyy-MM-dd')
    and a.instprocessid = b.instanceid
    and b.userid = c.userid and
         c.isprimary = '1'
   ) e,orgmodel_orgtoorg f
   
   where e.orgid=f.childid
 ) h,orgmodel_orginfo g
 where pp=g.id
 group by  g.name
14.处长的处理时间
select
  sum(taskendtime-taskstarttime)/count(*)
  from
  (
    select
  
     a.instprocessid,
     b.taskstarttime,
     b.taskendtime,
     b.userid
    from inst_process a, oa_tasklist b
    where a.instprocessid = b.instanceid
    and  state='4' and a.started>to_date('2007-02-24','yyyy-MM-dd')
  ) c,  (select
   distinct
   a.name rolename,
   b.userid
   from orgmodel_roleinfo  a,orgmodel_usertorole b
   where a.id = b.roleid
   and a.name='处长') d
   where c.userid=d.userid

 

 

HttpServletRequest接口:【上一篇】
起泡排序的Java实现:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 将 字符集为 导入到字符集为
  • [C#学习]枚举系统安装的所有打印机
  • 新的碰撞
  • 可怕的 C#
  • 保护你的 include 文件
  • 交换机基于有线电缆实现宽带服务
  • 用ANT批量完成J2ME 的编译
  • [转]DHTML理解
  • VB 从零开始编外挂
  • VB远程注入卸载DLL代码
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.