I do not guess that I follow what you are after. I do not see a need for a WITH statement here - rather just a self join since all the information you need seems to be in the EMPLOYEES table. Since there is no definition of thr REPORTS table, it is hard to say what that table's purpose is here...