我有一个名为tblIssueTicket的表tblIssueTicket包含以下字段:TicketID,TicketRequesterID,ApprovalManagerID,RequestDate,ApprovalDate,TicketStatus
还有另一个名为tblEmployeeProfile的表.tblEmployeeProfile包含EmployeeID,EmployeeFirstName,EmployeeLastName字段
我需要显示以下记录:
TicketID,TicketRequesterFullName,ApprovalManagerFullName,RequestDate,ApprovalDate,TicketStatus
我在查询查询以返回TicketRequester的全名和ApprovalManager字段的全名时遇到问题.
到目前为止,我的查询如下所示:
Select it.TicketID, ep.Firstname + ' ' + ep.EmployeeLastName AS TicketRequestorFullName, it.RequestDate, it.ApprovalDate, it.TicketStatus FROM tblIssueTicket it, tblEmployeeProfile ep WHERE ep.EmployeeID = it.TicketRequesterID
任何建议都会非常感激.
谢谢
厘米
SELECT it.TicketID, ep.Firstname + ' ' + ep.EmployeeLastName AS TicketRequestorFullName, mp.Firstname + ' ' + mp.EmployeeLastName AS ApprovalManagerFullName, it.RequestDate, it.ApprovalDate, it.TicketStatus FROM tblIssueTicket it INNER JOIN tblEmployeeProfile ep ON ep.EmployeeID = it.TicketRequesterID INNER JOIN tblEmployeeProfile mp ON mp.EmployeeID = it.ApprovalManagerID