select d.Name as Department, e.Name as Employee, e.Salary as Salary from Employee as e left join Department as d on e.DepartmentId = d.Id where e.Salary = (select max(Salary) from Employee e2 where e2.DepartmentId = d.Id)
I used a quite straightforward way, but got a TLE with no idea why. I see in the discussion someone uses the same approach of mine and passed it!
Any idea? Thanks!