Im having the following table , each employee have a manager, if a guy is his own manager den the managerid field is null, i want emid name and manager id as result
emid name and manager id
UNTESTED:
select a.name as name, b.name as managername from employee a inner join employee b on a.managerid=b.emid
This will only yield the employees who actually have a manager. But this is how you join a table on itself.