I´m having a bad time with a SQL query. I´m using oracle default tables:
\'EMP\' TABLE
http://imageshack.us/photo/my-images/850/sinttuloxps.png/
AND
You can also use the analytical RANK() function:
SELECT * FROM ( SELECT Dept.DeptNo, Dept.DName, Emp.EName, Emp.Sal, RANK() OVER (PARTITION BY Dept.DeptNo ORDER BY Emp.Sal DESC) AS DeptSalRank FROM Emp INNER JOIN Dept ON Emp.DeptNo = Dept.DeptNo ) WHERE DeptSalRank = 1