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;
Previous Topic: Re: generating row number
Next Topic: Masking special characters in SQLPLUS
Goto Forum:
  


Current Time: Tue Jul 02 17:28:06 CDT 2024