Department wise Max salaries:
SELECT
Employee.*
FROM
(select
deptno, max(salary) as MaxSalary
from
Employee
group by
DeptNo) MaxSalaries
INNER JOIN
Employee
ON
Employee.DeptNo = MaxSalaries.DeptNo AND
Employee.Salary = MaxSalaries.MaxSalary
Top 2 salaries
SELECT
top 2 Employee.*
FROM
(select
deptno, max(salary) as MaxSalary
from
Employee
group by
DeptNo) MaxSalaries
INNER JOIN
Employee
ON
Employee.DeptNo = MaxSalaries.DeptNo AND
Employee.Salary = MaxSalaries.MaxSalary
No comments:
Post a Comment