T-SQL,请问联表查询中的执行顺序
联表查询SQL如下
SELECT WOO.BillID
,WOO.ID
,WOO.CallNumber
,WOO.OrderType
,WOO.OrderSubType
,WOO.DataSource
,WOO.WorkOrderCreateTime
,WOO.StaffCode
,ISNULL(CAST(QI.Total AS NCHAR),'未质检') AS Total
,ISNULL(CAST(QI.SecondTotal AS NCHAR),'未质检') AS SecondTotal
,QI.Pass
,QI.SubTime
FROM
(
SELECT WO.BillID
,WO.ID
,WO.CallNumber
,OT.[Type] AS OrderType
,OST.[Type] AS OrderSubType
,WO.DataSource
,WO.WorkOrderCreateTime
,WO.StaffCode
FROM WorkOrderTwoFit WO
LEFT JOIN OrderType OT ON WO.OrderType = OT.ID
LEFT JOIN OrderType OST ON WO.OrderSubType = OST.ID
WHERE WO.DataSource = '电话'
AND WO.StaffCode = (SELECT StaffCode FROM StaffBaseInfo WHERE StaffID = @StaffID)
AND WO.WorkOrderCreateTime >= @SDATE AND WO.WorkOrderCreateTime < @EDATE
)WOO
LEFT JOIN
(
SELECT StaffCode
,Total
,SecondTotal
,Pass
,SubTime
FROM QuaInfo
)QI
ON WOO.StaffCode = QI.StaffCode