SELF JOIN
Join a table to itself. Useful for hierarchical data.
sql
1SELECT
2 e.name AS employee,
3 m.name AS manager
4FROM employees e
5LEFT JOIN employees m ON e.manager_id = m.id;
Join a table to itself. Useful for hierarchical data.
1SELECT
2 e.name AS employee,
3 m.name AS manager
4FROM employees e
5LEFT JOIN employees m ON e.manager_id = m.id;