Hi All
Been working on my T-SQL skills using the AdventureWorks 2008 database.
I want to get the Employee with the highest rate as well as the highest SickLeaveHours
This is what I have so far, am I heading in the right direction?
with cte as ( select he.EmployeeID, he.SickLeaveHours, ep.Rate , ROW_NUMBER () over (order by ep.rate desc) rn from HumanResources.Employee he inner join HumanResources.EmployeePayHistory ep on he.EmployeeID = ep.EmployeeID where he.SickLeaveHours = (select MAX (he.SickLeaveHours) from HumanResources.Employee he)) select * from cte where rn = 1