我在下面有这个查询,它工作正常,我得到了我需要的东西。我需要知道的是,这是编写此查询的正确方法,还是有任何方法可以缩短它?
我有 4 个表,第 1 个有分公司信息,第 2 个有客户信息,第 3 个有工程师信息,第 4 个有服务电话信息。
在服务调用表中,3 列与 3 个不同的工程师姓名匹配
这是查询
SELECT
B.BranchName, C.Name AS CustomerName,D.FullName AS CallOpenedBy,
A.CallOpenTime, A.CallMode, A.CallType, A.ReportedBy,
A.ReportedVia, A.ReportedProblem,
A.MaterialsReceived, A.MisComments, A.CallPriority, A.EstimatedAmount,
E.FullName AS EngineerName,
A.ActionTaken, A.CallClosedTime,
F.FullName AS CallClosedBy, A.Status,
A.Amount
FROM
TblServiceCalls A
INNER JOIN
TblBranchInfo B ON A.BranchID = B.BranchID
INNER JOIN
TblMainMaster C ON A.MasterID = C.MasterID
INNER JOIN
TblUserProfiles D ON A.CallOpenedBy = D.UserProID
INNER JOIN
TblUserProfiles E ON A.Engineer = E.UserProID
INNER JOIN
TblUserProfiles F ON A.CallClosedBy = F.UserProID
我可以缩短最后 3 行的查询吗?提前谢谢你们:)