zoukankan      html  css  js  c++  java
  • 如果你的项目中经常是这么长的sql语句咋办?

    select t5.intid,
           t5.strelementname,
           TT2.intobjectid,
           t6.dblweight,
           
    sum(TT2.score),
           
    sum(TT2.finalScore),
           t6.dblweight
    *sum(TT2.score) TotalScore 
    from 
    (
       
    select 
           t2.intid,
           t2.strelementname,
           
    sum(t.dblscore) score,
           t3.intobjectid,
           t4.dblweight,
           t4.dblweight
    *sum(t.dblscore) FinalScore,
           t2.intparentid
       
    from eva_score_detail t
       
    inner join eva_score t3 on t.intmasterid=t3.intid and t3.inttemplateid=14
       
    inner join eva_activity_elementdetail t1 on t.intelementdetailid = t1.intid
       
    inner join
       (
            
    select K2.INTID from eva_evasetting_elements K 
            
    inner join eva_activity_element K1 on K.intelementid=K1.intid and K1.intparentid=0
            
    inner join eva_activity_element K2 on K2.intparentid=K1.intid
            
    where K.inttemplateid=14
            
    union 
            
    select K3.INTID from eva_evasetting_elements K 
            
    inner join eva_activity_element K1 on K.intelementid=K1.intid and K1.intparentid=0
            
    inner join eva_activity_element K2 on K2.intparentid=K1.intid
            
    inner join eva_activity_element K3 on K3.intparentid=K3.intid
            
    where K.inttemplateid=14
      ) TT 
    on t1.intparentid=TT.INTID
       
    inner join eva_activity_element t2 on t2.intid = TT.intid
       
    inner join eva_evasetting_elements t4 on TT.intid=t4.intelementid and t4.inttemplateid=14
       
    group by t2.intid, t2.strelementname,t3.intobjectid,t4.dblweight,t2.intparentid
     ) TT2
     
    inner join eva_activity_element t5 on TT2.intparentid=t5.intid
     
    inner join eva_evasetting_elements t6 on t5.intid=t6.intelementid and t6.inttemplateid=14
     
    group by t5.intid,t6.dblweight,t5.strelementname,TT2.intobjectid
     
    order by tt2.intobjectid,t5.intid
  • 相关阅读:
    利用TLE数据确定卫星轨道(1)-卫星轨道和TLE
    关于javascript的单线程和异步的一些问题
    javascript编译与运行机理(1)--
    springMVC解决跨域
    如何实现免登陆功能(cookie session?)
    Map 接口有哪些类
    平时使用了哪些线程池
    Maven install报错:MojoFailureException ,To see the full stack trace of the errors, re-run Maven with the -e switch.解决
    记录新建dorado项目更新规则中报错
    Dynamic Web Module 3.0 requires Java 1.6 or newer
  • 原文地址:https://www.cnblogs.com/jackhuclan/p/1326244.html
Copyright © 2011-2022 走看看