![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I'm trying to use a recursive CTE to find some data but I am having trouble crafting the CTE; maybe what I want isn't possible. I have the following tables: EMPLOYEE (int ID, int MANAGER_ID) WINNER(int EMPLOYEE_ID) * The heirarchy in EMPLOYEE may be multiple levels deep. * MANAGER_ID is a foreign key to EMPLOYEE.ID * WINNER.EMPLOYEE_ID is a foreign key to EMPLOYEE.ID Basically, I want to generate a list of EMPLOYEE.ID data which satisfies the following criteria: 1) The ID is present in the WINNER table, -or- 2) A child record of the current record, or a child of a child (ad infinitum) is present in the WINNER table |
#4
| |||
| |||
|
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |