答案 0 :(得分:0)
试试这个:
SELECT
employee.id,
employee.`name`,
boss.`name` boss_name
FROM
employee
LEFT JOIN employee boss ON (
boss.id = employee.boss_id
)
ORDER BY id ASC
答案 1 :(得分:-1)
你可以使用自我联接来实现,如:
SELLECT `user`.id,`user`.`name`,`boss`.`name` FROM `user` `user` left join `user` `boss` on (`boss`.`boss_id`=`user`.`id`)
我希望它能帮到你