写找出工资比经理高的员工姓名 on 雇员表的经理id=经理表的雇员id

/*
雇员表 包含4列 雇员id ,姓名,工资,经理id,写找出工资比经理高的员工姓名
employee id name salary managerid
1 joe 7000 3
2 henry 8000 4
3 sam 6000 null
4 max 9000 null

*/

select e.name,e.salary
from employee as e
left join employee as m
on e.managerid=m.id
where e.salary>m.salary

posted @ 2025-04-14 13:40  胖豆芽  阅读(9)  评论(0)    收藏  举报