tags:

views:

114

answers:

1

Hi, I have a table called tblIssueTicket tblIssueTicket contains the fields: TicketID, TicketRequesterID, ApprovalManagerID, RequestDate, ApprovalDate, TicketStatus

There is another table called tblEmployeeProfile. tblEmployeeProfile contains fields EmployeeID, EmployeeFirstName, EmployeeLastName

I need to display the following records:

TicketID, TicketRequesterFullName, ApprovalManagerFullName, RequestDate, ApprovalDate, TicketStatus

I am having problems figuring out the query to return the fullname of the TicketRequester & fullname of ApprovalManager fields.

My query so far looks like this:

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

Any advice would greatly appreciated.

Thanks

CM

+5  A: 
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
Mitch Wheat