查询

in关键字的使用

不局限于 salary in( , )

还可以是(departmentId, salary) in (select departmentId, salary from ....)

 

select D.Name Department, E.Name Employee, Salary from Department D inner join Employee E on D.Id = DepartmentId 
where (DepartmentId, Salary) in  (select DepartmentId, max(Salary) from Employee group by DepartmentId)

 

posted @ 2021-08-11 17:07  立志成为Java大神  阅读(19)  评论(0)    收藏  举报