Subject Re: [firebird-support] Recursive query (get all employees under master department)
Author Newbie
this is exactly what I needed. Thank you :)

>
> If what you're asking is what I think, then the answer is very simple:
>
> (same CTE as you already have)
>
> SELECT * FROM fs_tree fs
> JOIN employee e on fs.dept_id = e.dept_id
>
> Of course, you could also put this in the CTE itself (then you might
> have to do it both before and after UNION ALL), but you haven't
> mentioned any "employee recursion" (e.g. list all employees whose
> leaders or their leaders belong to the department, regardless of
> whether the employee or his closest leader belong to the department),
> so there isn't much reason to complicate things.
>
> HTH,
> Set
>
>



[Non-text portions of this message have been removed]