Skip to content

Instantly share code, notes, and snippets.

@candrasetiadi
Last active January 7, 2019 16:21
Show Gist options
  • Save candrasetiadi/865a12208332cde0054fc478bb8fe5ab to your computer and use it in GitHub Desktop.
Save candrasetiadi/865a12208332cde0054fc478bb8fe5ab to your computer and use it in GitHub Desktop.
candra-jabar-digital-service
-- Write only the SQL statement that solves the problem and nothing else.
SELECT S.name
FROM
(SELECT a.id, a.managerId, a.name FROM employees AS a) AS S
LEFT JOIN
(SELECT e.id, e.managerId, e.name FROM employees as e WHERE e.managerId IS NOT NULL) AS T
ON S.id = T.managerId
WHERE T.managerId IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment