My solution, not fastest, but one select


  • 0
    M

    select d.Name Department, e1.Name Employee, e1.Salary
    from Employee e1, Employee e2, Department d
    where e1.Salary <= e2.Salary and e1.DepartmentId = e2.DepartmentId and e1.DepartmentId = d.Id
    group by e1.DepartmentId, e1.Id
    having count(distinct e2.Salary) = 1;


  • 0
    C

    hi,thanks for your idea ,
    but it's hard for me to understand the last clause "having count(distinct e2.Salary)=1" .
    can you help me?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.