Skip to content

Instantly share code, notes, and snippets.

@andyp14feb
Created January 17, 2019 12:33
Show Gist options
  • Save andyp14feb/8072dda442d53d9cf3186876fcbd4f4f to your computer and use it in GitHub Desktop.
Save andyp14feb/8072dda442d53d9cf3186876fcbd4f4f to your computer and use it in GitHub Desktop.
SELECT
e1.name
FROM
employees e1
LEFT JOIN(
SELECT DISTINCT
managerid
FROM
employees
WHERE
managerid IS NOT NULL
)e2 ON e2.managerid = e1.id
WHERE
e2.managerid IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment