ITPub博客

首页 > Linux操作系统 > Linux操作系统 > SQL查询效率好低

SQL查询效率好低

原创 Linux操作系统 作者:itput_bobo 时间:2012-01-10 16:55:41 0 删除 编辑

select
 vpb.PROJECTNAME 项目名称,
       vpb.PROJECTCODE 项目编号,
       vpb.PRIORITY 项目级别,
       vpb.PROJECTTYPE 项目类别,
       vpb.PROJECTSTAT 项目状态,
       vpb.DEPARTMENTNAME 所属部门,
       (select username from org_userinfo where delflag=0 and userid=(select userid from pj_projectaccess where roleid=
       (select roleid from org_role where rolename='部门领导' and delflag=0 and roletypeid=4) and projectid=vpb.PROJECTID)) 部门领导,
       (select username from org_userinfo where delflag=0 and userid=(select userid from pj_projectaccess where roleid=
       (select roleid from org_role where rolename='项目分管' and delflag=0 and roletypeid=4) and projectid=vpb.PROJECTID)) 项目分管,
       (select username from org_userinfo where delflag=0 and userid=(select userid from pj_projectaccess where roleid=
       (select roleid from org_role where rolename='项目经理' and delflag=0 and roletypeid=4) and projectid=vpb.PROJECTID)) 项目经理,
       vpb.REQUIREDEPT 需求部门,
       o.USERNAME 项目负责人,
       vpb.PLANSTARTDATE 计划开始时间,
       vpb.PLANENDDATE 计划完成时间,
       vpb.ACTUALSTARTDATE 实际开始时间,
       vpb.ACTUALENDDATE 实际完成时间,
      (select sum(fcb.sumfee) from fin_cbs_baseinfo fcb where fcb.contractid in (select fcwr.contractid from    fin_cbs_wbs_relation fcwr where

fcwr.projectid=vpb.projectid)) 合同金额,/*合同金额*/
       (select sum(fcta.actualfee) from fin_cbs_track_actual fcta where fcta.eventid in (select fct.eventid from fin_cbs_track fct where fct.contractid in (select

fcwr.contractid from fin_cbs_wbs_relation fcwr where fcwr.projectid=vpb.projectid))) 已付款  , /*已付款*/

       (select sum(fcta.actualpercent) from fin_cbs_track_actual fcta where fcta.eventid in (select fct.eventid from fin_cbs_track fct where fct.contractid in (select

fcwr.contractid from fin_cbs_wbs_relation fcwr where fcwr.projectid=vpb.projectid))) 付款比例 , /*付款比例*/
       vpb.STARTYEAR 启动财年
  from (select  * from view_pj_baseinfo where 1=1  ) vpb left join org_userinfo o
  on vpb.PROJECTFZR = o.userid and o.delflag=0

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26615664/viewspace-714698/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-01-10

  • 博文量
    1
  • 访问量
    1279