注册 登录
编程论坛 SQL Server论坛

这段是在写什么?

wube 发布于 2017-05-15 12:55, 2070 次点击
晕倒了...

程序代码:

Private Function GetExcelSQL(ByVal blFCSTOrder As Boolean) As String
        Dim mySQL As String
        Dim strColorIndex As String
        Dim strColorIndexJoinTable As String
        If blFCSTOrder = True Then
            strColorIndex = "ISNULL(D.Priority, 4) AS ColorIndex"
            strColorIndexJoinTable = "LEFT OUTER JOIN tblBasStatusDesc AS G ON D.Priority = G.Status AND G.Category = 'ProjectFCST' "
        Else
            strColorIndex = "ISNULL(A.Phase, 10) AS ColorIndex"
            strColorIndexJoinTable = "LEFT OUTER JOIN tblBasStatusDesc AS G ON A.Phase = G.Status AND G.Category = 'ProjectPhase' "
        End If
        mySQL = "SELECT * FROM ("
        mySQL += "SELECT A.ProjectNo, A.NPINumber, A.DevpType, A.ProjectType, A.CustomerNo, A.DeviceNo, A.Platform01, A.Platform02, A.Platform03, A.ProductType, A.RequestService, A.Div, "
        mySQL += "A.EngineerNo, A.ConsultantNo, A.SupervisorNo, A.SalesNo, A.ApplicationDate, A.KickoffDate, A.EstFinishDate, A.DepartmentNo, A.Remark, A.ReleaseStatus, A.ReleaseStatusDate, "
        mySQL += "A.Phase, A.PhaseDate, "
        mySQL += "B.ProbeCard, B.ProbeCardPlanFrom, B.ProbeCardPlanTo, B.ProbeCardPlanRevise, B.ProbeCardActualFrom, B.ProbeCardActualTo, B.ProbeCardActualRevise, B.ProbeCardActualReady, B.ProbeCardHours, B.ProbeCardMemo, "
        mySQL += "B.DutBoard, B.DutBoardPlanFrom, B.DutBoardPlanTo, B.DutBoardPlanRevise, B.DutBoardActualFrom, B.DutBoardActualTo, B.DutBoardActualRevise, B.DutBoardActualReady, B.DutBoardHours, B.DutBoardMemo, "
        mySQL += "B.ChangeKit, B.ChangeKitPlanFrom, B.ChangeKitPlanTo, B.ChangeKitPlanRevise, B.ChangeKitActualFrom, B.ChangeKitActualTo, B.ChangeKitActualRevise, B.ChangeKitHours, B.ChangeKitMemo, "
        mySQL += "B.TestProgram, B.TestProgramPlanFrom, B.TestProgramPlanTo, B.TestProgramPlanRevise, B.TestProgramActualFrom, B.TestProgramActualTo, B.TestProgramActualRevise, B.TestProgramActualReady, B.TestProgramHours, B.TestProgramMemo, "
        mySQL += "B.LaserRepair, B.LaserRepairPlanFrom, B.LaserRepairPlanTo, B.LaserRepairPlanRevise, B.LaserRepairActualFrom, B.LaserRepairActualTo, B.LaserRepairActualRevise, B.LaserRepairHours, B.LaserRepairMemo, "
        mySQL += "B.TPVerification, B.TPVerificationPlanFrom, B.TPVerificationPlanTo, B.TPVerificationPlanRevise, B.TPVerificationActualFrom, B.TPVerificationActualTo, B.TPVerificationActualRevise, B.TPVerificationActualReady, B.TPVerificationHours, B.TPVerificationMemo, "
        mySQL += "B.Correlation, B.CorrelationPlanFrom, B.CorrelationPlanTo, B.CorrelationPlanRevise, B.CorrelationActualFrom, B.CorrelationActualTo, B.CorrelationActualRevise, B.CorrelationHours, B.CorrelationMemo, "
        mySQL += "B.ReleaseMeeting, B.ReleaseMeetingPlanFrom, B.ReleaseMeetingPlanTo, B.ReleaseMeetingPlanRevise, B.ReleaseMeetingActualFrom, B.ReleaseMeetingActualTo, B.ReleaseMeetingActualRevise, B.ReleaseMeetingHours, B.ReleaseMeetingMemo, "
        mySQL += "C.TestRate, C.CUP, C.TGResolution, C.Site, C.Channel, C.Temperature, C.AddOnModule, C.VM, C.TransInTester, C.ProductTypeDesc1, C.ProductTypeDesc2, "
        mySQL += "C.DevpCategory, C.MixSignal, C.WaferInch, C.ProbeCardNo, C.DutBoardNo, C.PadCount, C.NiddleCount, C.DataCollectDate, C.PackageType, C.PackageType2, "
        mySQL += "D.FCST, D.Schedule AS FCSTSchedule, D.Priority, ISNULL(D.Priority, 4) AS FCSTOrder, "
        mySQL += "E.FormDate, E.FirstLot, E.SecondLot, E.ThirdLot, E.FineTune, E.FTSec, E.CPSec, "
        mySQL += "F.CustomerEngSName, F.CustomerChiSName, "
        mySQL += strColorIndex & ", G.StatusDesc AS PhaseDesc "
        mySQL += "FROM tblProject AS A INNER JOIN tblProjectWorkPlan AS B ON A.ProjectNo = B.ProjectNo "
        mySQL += "LEFT OUTER JOIN tblProjectProductInfo AS C ON A.ProjectNo = C.ProjectNo "
        mySQL += "LEFT OUTER JOIN tblProjectFCST AS D ON A.ProjectNo = D.ProjectNo "
        mySQL += "LEFT OUTER JOIN tblProjectReleaseLots AS E ON A.ProjectNo = E.ProjectNo "
        mySQL += "LEFT OUTER JOIN tblMstCustomerPublic F ON A.CustomerNo = F.CustomerNo "
        mySQL += strColorIndexJoinTable
        mySQL += "WHERE "
        If radReportTD.Checked = True Then
            mySQL += "A.DevpType = 'TD' "
        Else
            mySQL += "A.DevpType = '客戶' "
        End If
        mySQL += "AND A.ReleaseStatus < 4) AS myTable "
        mySQL += hdfSort.Value
        Return mySQL
    End Function
2 回复
#2
wube2017-06-06 17:14
帮忙翻译解释一下这在写什么?

程序代码:

SELECT * FROM (SELECT A.ProjectNo, A.NPINumber, A.DevpType, A.ProjectType, A.CustomerNo, A.DeviceNo, A.Platform01, A.Platform02, A.Platform03, A.ProductType,
A.RequestService, A.Div, A.EngineerNo, A.ConsultantNo, A.SupervisorNo, A.SalesNo, A.ApplicationDate, A.KickoffDate, A.EstFinishDate, A.DepartmentNo, A.Remark,
A.ReleaseStatus, A.ReleaseStatusDate, A.Phase, A.PhaseDate, B.ProbeCard, B.ProbeCardPlanFrom, B.ProbeCardPlanTo, B.ProbeCardPlanRevise, B.ProbeCardActualFrom,
B.ProbeCardActualTo, B.ProbeCardActualRevise, B.ProbeCardActualReady, B.ProbeCardHours, B.ProbeCardMemo, B.DutBoard, B.DutBoardPlanFrom, B.DutBoardPlanTo,
B.DutBoardPlanRevise, B.DutBoardActualFrom, B.DutBoardActualTo, B.DutBoardActualRevise, B.DutBoardActualReady, B.DutBoardHours, B.DutBoardMemo, B.ChangeKit,
B.ChangeKitPlanFrom, B.ChangeKitPlanTo, B.ChangeKitPlanRevise, B.ChangeKitActualFrom, B.ChangeKitActualTo, B.ChangeKitActualRevise, B.ChangeKitHours,
B.ChangeKitMemo, B.TestProgram, B.TestProgramPlanFrom, B.TestProgramPlanTo, B.TestProgramPlanRevise, B.TestProgramActualFrom, B.TestProgramActualTo,
B.TestProgramActualRevise, B.TestProgramActualReady, B.TestProgramHours, B.TestProgramMemo, B.LaserRepair, B.LaserRepairPlanFrom, B.LaserRepairPlanTo,
B.LaserRepairPlanRevise, B.LaserRepairActualFrom, B.LaserRepairActualTo, B.LaserRepairActualRevise, B.LaserRepairHours, B.LaserRepairMemo, B.TPVerification,
B.TPVerificationPlanFrom, B.TPVerificationPlanTo, B.TPVerificationPlanRevise, B.TPVerificationActualFrom, B.TPVerificationActualTo, B.TPVerificationActualRevise,
B.TPVerificationActualReady, B.TPVerificationHours, B.TPVerificationMemo, B.Correlation, B.CorrelationPlanFrom, B.CorrelationPlanTo, B.CorrelationPlanRevise,
B.CorrelationActualFrom, B.CorrelationActualTo, B.CorrelationActualRevise, B.CorrelationHours, B.CorrelationMemo, B.ReleaseMeeting, B.ReleaseMeetingPlanFrom,
B.ReleaseMeetingPlanTo, B.ReleaseMeetingPlanRevise, B.ReleaseMeetingActualFrom, B.ReleaseMeetingActualTo, B.ReleaseMeetingActualRevise, B.ReleaseMeetingHours,
B.ReleaseMeetingMemo, C.TestRate, C.CUP, C.TGResolution, C.Site, C.Channel, C.Temperature, C.AddOnModule, C.VM, C.TransInTester, C.ProductTypeDesc1,
C.ProductTypeDesc2, C.DevpCategory, C.MixSignal, C.WaferInch, C.ProbeCardNo, C.DutBoardNo, C.PadCount, C.NiddleCount, C.DataCollectDate, C.PackageType,
C.PackageType2, D.FCST, D.Schedule AS FCSTSchedule, D.Priority, ISNULL(D.Priority, 4) AS FCSTOrder, E.FormDate, E.FirstLot, E.SecondLot, E.ThirdLot, E.FineTune,
E.FTSec, E.CPSec, F.CustomerEngSName, F.CustomerChiSName, ISNULL(A.Phase, 10) AS ColorIndex,
G.StatusDesc AS PhaseDesc FROM tblProject AS A
INNER JOIN tblProjectWorkPlan AS B ON A.ProjectNo = B.ProjectNo
LEFT OUTER JOIN tblProjectProductInfo AS C ON A.ProjectNo = C.ProjectNo
LEFT OUTER JOIN tblProjectFCST AS D ON A.ProjectNo = D.ProjectNo
LEFT OUTER JOIN tblProjectReleaseLots AS E ON A.ProjectNo = E.ProjectNo
LEFT OUTER JOIN tblMstCustomerPublic F ON A.CustomerNo = F.CustomerNo
LEFT OUTER JOIN tblBasStatusDesc AS G ON A.Phase = G.Status AND G.Category = 'ProjectPhase' WHERE A.ReleaseStatus < 4) AS myTable
#3
wp2319572017-06-06 17:54
数据库
A.XXX  B.XXX C.XXX 这里ABC 都是数据库里面的表名称 XXX是具体的字段名称  剩下的SELECT * FROM 啥的都是sql语句
1