Custom Data Set

  • Thread starter Thread starter Paola
  • Start date Start date
P

Paola

I have a master table that has a author and a manager
column (which have the employee id). I have joined the
employee id from the employee table to both author and
manager and want the results to show the employees full
name versus their employee id under both author and
manager columns.

Right now I can only get either the author full_name or
the manager full_name but not both.

Any ideas?
 
Try something along the lines of
SELECT M.author, E1.[full_Name] As authorName, M.manager,
E2.[full_Name] as managerName
FROM (Master M INNER JOIN Employee E1 ON M.author =
E1.[employeeId]) INNER JOIN Employee E2 ON M.manager =
E2.[employeeId]

You will have to change the table and column names to suit
your app.

Hope This Helps
Gerald Stanley MCSD
 
What does the E1 and E2 stand for?
-----Original Message-----
Try something along the lines of
SELECT M.author, E1.[full_Name] As authorName, M.manager,
E2.[full_Name] as managerName
FROM (Master M INNER JOIN Employee E1 ON M.author =
E1.[employeeId]) INNER JOIN Employee E2 ON M.manager =
E2.[employeeId]

You will have to change the table and column names to suit
your app.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a master table that has a author and a manager
column (which have the employee id). I have joined the
employee id from the employee table to both author and
manager and want the results to show the employees full
name versus their employee id under both author and
manager columns.

Right now I can only get either the author full_name or
the manager full_name but not both.

Any ideas?
.
.
 
They are table name aliases to the Employee Table. The
Employee table is referenced twice in the FROM statement
and so needs to be aliased so that the SELECT knows which
column to take from which reference.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
What does the E1 and E2 stand for?
-----Original Message-----
Try something along the lines of
SELECT M.author, E1.[full_Name] As authorName, M.manager,
E2.[full_Name] as managerName
FROM (Master M INNER JOIN Employee E1 ON M.author =
E1.[employeeId]) INNER JOIN Employee E2 ON M.manager =
E2.[employeeId]

You will have to change the table and column names to suit
your app.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a master table that has a author and a manager
column (which have the employee id). I have joined the
employee id from the employee table to both author and
manager and want the results to show the employees full
name versus their employee id under both author and
manager columns.

Right now I can only get either the author full_name or
the manager full_name but not both.

Any ideas?
.
.
.
 
Back
Top