I have a table EmpDetails:
EmpDetails
DeptID EmpName Salary Engg Sam 1000 Engg Smith 2000 HR Denis 1500 HR
Use correlated subquery:
SELECT DeptID, EmpName, Salary FROM EmpDetails a WHERE Salary = (SELECT MAX(Salary) FROM EmpDetails b WHERE a.DeptID = b.DeptID)