I have a table EmpDetails:
EmpDetails
DeptID EmpName Salary Engg Sam 1000 Engg Smith 2000 HR Denis 1500 HR
If you want to show other parameters too along with DeptId and Salary like EmpName, EmpId
DeptId
Salary
EmpName
EmpId
SELECT EmpID , Name, , Salary , DeptId FROM Employee where (DeptId,Salary) in (select DeptId, max(salary) from Employee group by DeptId)