$ 0 0 Try,WITH RECURSIVE REC_TBL ( emp_id, boss_id ) AS (SELECT emp_id, (boss_id) AS boss_id FROM employee_tbl UNION ALL SELECT a.emp_id, b.boss_id FROM REC_TBL A , employee_tbl b WHERE a.boss_id = b.emp_id) SELECT * FROM REC_TBL
Try,
WITH RECURSIVE REC_TBL ( emp_id, boss_id ) AS
(SELECT
emp_id, (boss_id) AS boss_id FROM employee_tbl
UNION ALL
SELECT a.emp_id, b.boss_id
FROM REC_TBL A , employee_tbl b
WHERE a.boss_id = b.emp_id
)
SELECT
*
FROM REC_TBL