如何添加名字和姓氏作为查询结果?

How do I add the first and last name as a query result?

我正在运行 mySQL 查询以通过经理的 ID 查找员工的经理。我能够按如下方式让它工作:

SELECT e.first_name
     , m.first_name AS manager_name 
  FROM employee e 
  JOIN employee m 
    on e.manager_id = m.employee_id

但是,我想在结果中包含经理的名字和姓氏,但我无法找出正确的语法来连接它。

感谢任何帮助

您只需要字符串连接吗?

select e.first_name, 
    concat(m.first_name, ' ',  m.last_name) as manager_full_name
from employee e 
join employee m on m.employee_id = e.manager_id

你只需要e数据,如果你的列是last_name

SELECT 
CONCAT(m.first_name,' ', m.last_name) AS manager_name 
FROM employee e 
JOIN employee m on e.manager_id = m.employee_id