I am getting this error. and don’t understand where did i go wrong?
Error Code: 1052. Column ‘FIRST_NAME’ in field list is ambiguous
I tried doing this as below but unable to find an answer….
SELECT E.EMP_ID, CONCAT(FIRST_NAME,' ',LAST_NAME) AS EMPLOYEE_NAME,
CONCAT(FIRST_NAME,' ',LAST_NAME) AS MANAGER_NAME
FROM EMPLOYEES AS E JOIN EMPLOYEES AS M
ON(E.MANAGER_ID = M.EMP_ID);
>Solution :
Correct code should be like this like @jarlh said in comments
SELECT E.EMP_ID, CONCAT(E.FIRST_NAME,' ',E.LAST_NAME) AS EMPLOYEE_NAME,
CONCAT(E.FIRST_NAME,' ',E.LAST_NAME) AS MANAGER_NAME
FROM EMPLOYEES AS E JOIN EMPLOYEES AS M
ON(E.MANAGER_ID = M.EMP_ID);