add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
WITH yourTable AS (
SELECT 'Jill' AS Name, NULL AS ReportsTo, 'manager' AS Position UNION ALL
SELECT 'Nathan', 'Jill', 'junior'
)

SELECT t1.Name, t1.ReportsTo, t1.Position, COALESCE(t2.Position, 'none') AS Boss
FROM yourTable t1
LEFT JOIN yourTable t2
ON t2.Name = t1.ReportsTo;






Name ReportsTo Position Boss
Jill null manager none
Nathan Jill junior manager