我收到此错误。不明白我哪里错了?
错误代码:1052。字段列表中的“FIRST_NAME”列不明确
我尝试按如下方式执行此操作,但找不到答案......
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);
正确的代码应该像@jarlh在评论中所说的那样
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);