Recursive Query
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
select id,
full_name,
department,
line_manager,
employee_ad_id
from (select * from tbl_employees
order by line_manager, id) products_sorted,
(select @pv := '173') initialisation
where find_in_set(line_manager, @pv)
and length(@pv := concat(@pv, ',', id))