I have a helpdesk application I'm modifying.
I need to pull data into an ASP.Net DataGrid.
problems table, there is a field for
employeeID, which is the employee id of the person entering the ticket. There is also a rep field which holds the employee id of the rep handling the ticket.
I'm trying get the employee NAME for both the person entering the ticket and the rep handling the ticket from a users table.
Here are the relevant fields…
Problem Table: pID employeeID sLocation sRoom pRep Users Table: fName lName empID
Here's an example of a query I'm using to pull the problems associated with just one rep:
SELECT p.pID, u.fName + ' ' + u.lName as FullName, p.sLocation, p.sRoom, p.pStatus, p.pTitle FROM Problems p INNER JOIN tblUsers u ON p.employeeID = u.empID WHERE p.pRep=Session("EmpID")
If I want to pull all the problems and list the rep who is handling the issue, what would that query be?
Would it look something like this (thought I feel sure there's more to that join statement)
SELECT p.pID, u.fName + ' ' + u.lName as EmpFullName, p.sLocation, p.sRoom, p.pStatus, p.pTitle, u.fName + ' ' + u.lName as RepFullName FROM Problems p INNER JOIN tblUsers u ON p.employeeID = u.empID WHERE p.pStatus='OPEN'