Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Is this a subquery I need?
people table fields:
I need to get all the info, plus the login of the manager where manager_id references the record in the people table.
This is why I'm not a DBA

This comment has been minimized.

Copy link

@bitzbyte bitzbyte commented Feb 4, 2014

I'd use a JOIN:

SELECT L.first_name, L.last_name, L.login, R.login
    FROM Table AS L
    LEFT OUTER JOIN Table AS R ON (L.manager_id =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment