How to retrieve employee id of managers
Posted on 2014-11-03
I'm working on an application that I inherited. There is an employee table that lists all the employees as well as the managers. The problem is that the table uses a the last name of the manager as a key field rather than a manager id field. I'm added a mgr_id field. I am now trying to populate the mgr_id field by executing a query that returns the employee id of each manager and using that employee id field named CUID to populate the mgr_id field that I added. I started off by writing a sql query that returns that information to verify that I was selecting the correct value. However, it is still retreiving only the cuid of the employee and not of the manager.
SELECT Employee.CUID, Employee.Mgr_LName
WHERE Employee.[Mgr_LName] In (SELECT LName FROM Employee);