Department Highest Salary
join虛擬x表

聚合子查詢

有找課程資料 上課有教

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

======雷======

2025/11/26

select Department.name AS Department,Employee.name AS Employee,Salary

from Employee join Department on Employee.departmentId = Department.id
join (
    select departmentId,Max(Salary) AS MaxSalary
    from Employee Group by departmentId
) AS x
on 
Employee.departmentId = x.departmentId
AND Employee.Salary = x.MaxSalary

創作者介紹
創作者 2026年羽水記事本 的頭像
羽水

2026年羽水記事本

羽水 發表在 痞客邦 留言(0) 人氣( 2 )