What's wrong with my code?

  • 0

    select Department.Name Department ,Employee.Name Employee, max(Salary) Salary
    from Employee join Department on Employee.DepartmentId = Department.ID
    group by Department.ID
    order by Department.ID

    {"headers": {"Employee": ["Id", "Name", "Salary", "DepartmentId"], "Department": ["Id", "Name"]}, "rows": {"Employee": [[1, "Joe", 70000, 1], [2, "Henry", 80000, 2], [3, "Sam", 60000, 2], [4, "Max", 90000, 1]], "Department": [[1, "IT"], [2, "Sales"]]}}

    my output:
    {"headers": ["Department", "Employee", "Salary"], "values": [["IT", "Joe", 90000], ["Sales", "Henry", 80000]]}

    {"headers": ["Department", "Employee", "Salary"], "values": [["Sales", "Henry", 80000], ["IT", "Max", 90000]]}

Log in to reply

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