Recursive Queries in ADO

  • Thread starter Thread starter Rob Edwards
  • Start date Start date
R

Rob Edwards

Table: Employee
Fields: EmployeeNumber, EmployeeLastName, EmployeeFirstName, UnitNumber,
Phone, ManagerID

Table: Units
Fields: UnitNumber, UnitName, UnitManager

A Unit can have one manager (the EmployeeNumber from the Employee table).
Employees can be members of only one unit (Unit Number in Employee table).
An Employee can have only one Manager.

Now here is the challenge: I want a Listbox to display all the units for a
particular manager... and also list all the units for employees that report
to that manager... recursively down the table.

In other words, if I am the UnitManager of 3 units... and I have two people
that report to me who manage 5 units.. and they have 7 people who report to
them who manager 15 units.... how can I display in one listbox all 23 units?
 
Thanks for Rajesh's response.

Hi Rob,

It seems that we cannot achieve this by a query. I think you can write some
code to get the list of the employees from the dataset.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top