Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Recursive query - response (3) by gerardo

$
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


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>