• 整合问题


    SELECT  RTRIM(LTRIM(WorkName)) WorkName, t.BZKTypeName, t.TestProject,
            t.Factor, BJ, BL
    FROM    #tbl t
    ORDER BY WorkName, t.BZKTypeName DESC, t.TestProject DESC, t.factor DESC   
     
     
    SELECT  *
    FROM    dbo.ScoreCode
    WHERE   IsDelete = 0


    SELECT  RTRIM(LTRIM(WorkName)) WorkName, t.BZKTypeName, t.TestProject,
            t.Factor, BJ, BL, s.Factor AS Factor1
    INTO    #t
    FROM    #tbl t
            RIGHT JOIN ( SELECT *
                         FROM   dbo.ScoreCode
                         WHERE  IsDelete = 0
                       ) s ON t.BZKTypeName = s.BzkTypeName
                              AND t.TestProject = s.TestProject
    ORDER BY WorkName, t.BZKTypeName DESC, t.TestProject DESC, t.factor DESC   
     

    SELECT  DISTINCT
            WorkName, BZKTypeName, TestProject, Factor1, 0 BJ, 0 BL
    INTO    #t1
    FROM    #t
    WHERE   WorkName IS NOT NULL
     
    UPDATE  #t1
    SET     BJ = s1.BJ, BL = s1.BL
    FROM    #t1 ,
            ( SELECT  DISTINCT
                        WorkName, BZKTypeName, TestProject, Factor, BJ, BL
              FROM      #t
              WHERE     WorkName IS NOT NULL
            ) s1
    WHERE   #t1.BZKTypeName = s1.BZKTypeName
            AND #t1.TestProject = s1.TestProject
            AND #t1.Factor1 = s1.Factor
            AND #t1.WorkName = s1.WorkName

    SELECT  *
    FROM    #t1
     
     
    DROP TABLE #t
    DROP TABLE #t1

  • 相关阅读:
    Asp.net MVC3 Routing study
    Sharepoint 站点页面错误问题
    vc2010 学习笔记1
    UML类成员的困惑
    河道二维水流模拟高精度算法研究
    朱庆:真三维GIS技术进展
    map
    SIGGRAPH 2010: 一场视觉盛宴[转]
    新网站开张,欢迎大家
    获取其它进程内EDIT BOX内容的一种方法
  • 原文地址:https://www.cnblogs.com/qanholas/p/2678764.html
Copyright © 2020-2023  润新知