Home » RDBMS Server » Server Administration » Re: sql help - I have a prob too
Re: sql help - I have a prob too [message #373819] |
Mon, 14 May 2001 13:34 |
Tara
Messages: 4 Registered: July 1999
|
Junior Member |
|
|
I'm trying to create a query of employees by who they report to. The hierarchy is 4 levels. I want to create a report showing all 4 levels. Currently i'm using a union but it doesn't show the 4th level. only the top three.
Here's the current query:
SELECT EmailID, FirstName, LastName
FROM Employees
WHERE ReportsTo='JDOE' or EmailID = 'JDOE'
ORDER BY LastName,FirstName
UNION SELECT EmailID, FirstName, LastName
FROM Employees
WHERE ReportsTo in (Select EmailID FROM Employees WHERE ReportsTo = 'JDOE')
ORDER BY LastName, FirstName;
|
|
|
Goto Forum:
Current Time: Mon Jan 13 15:03:08 CST 2025
|