用子查询的方法查询研发部比财务部员收入都高的姓名

我自己写的不知道有什么问题,他直接把所以研发部的都给我了,没有比较,而且重复了,求解答。自己写的和要用的三张表如下图

img

img

img

img

主查询那里员工表和薪资表没有关联关系,数据发散了,>all 的语法你测试下有没有问题

select t1.employeeid,t1.name,t.income
  from salary t
  join employees t1
    on t.employeeid=t1.employeeid
  join departments t2
    on t1.departmentid=t2.departmentid
 where t2.departmentname='研发部'
   and t.income>
(select max(t.income)
  from salary t
  join employees t1
    on t.employeeid=t1.employeeid
  join departments t2
    on t1.departmentid=t2.departmentid
 where t2.departmentname='财务部')