select
temp.dept_no,dept_emp.emp_no,salary
from
salaries,dept_emp,
(
select
d.dept_no,
max(salary) maxSalary
from
dept_emp d,
salaries s
where
d.emp_no = s.emp_no
group by
dept_no
) as temp
where
salary = temp.maxSalary and dept_emp.emp_no=salaries.emp_no