Published on

Leetcode - 1270. All People Report to the Given Manager

Authors
  • avatar
    Name
    Indo Yoon
    Twitter
Table of Contents

Problem

[LeetCode - The World’s Leading Online Programming Learning Platform

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

LeetCode

](https://leetcode.com/problems/all-people-report-to-the-given-manager/description/)

Solution

SELECT E1.employee_id
FROM Employees AS E1, Employees AS E2, Employees AS E3
WHERE 
    E1.manager_id = E2.employee_id AND
    E2.manager_id = E3.employee_id AND
    E3.manager_id = 1 AND e1.employee_id != 1