• Hi slange,

    I think you're confusing a couple of possibilities.

    The query above reports employees who have no "subordinates" - there are no employees that have their employeeid in the reportsto field.

    The query that you are thinking of is almost exactly the opposite:

    select *

    from employees

    left join employees as supervisors on employees.reportsto = supervisors.employeeid

    where supervisors.employeeid Is Null

    and employees.reportsto Is Not Null

    It's actually slightly different because it also has an extra WHERE criterion - making sure that the employees returned actually have a reportsto value (for a supervisor that no longer exists, or never existed).

    Does this help?

    http://poorsql.com for T-SQL formatting: free as in speech, free as in beer, free to run in SSMS or on your version control server - free however you want it.