Home Forums SQL Server 2005 Development Select second highest wage RE: Select second highest wage
jerry-621596
SSCertifiable
Points: 6096
More actions
November 1, 2010 at 11:50 am
#1244973
I got it with this:
SELECT TOP 1 EmpID, MAX(EmpWage) AS [Max Wage]
FROM EmpDetails
GROUP BY EmpID
HAVING MAX(EmpWage) < (SELECT TOP 1 MAX(EmpWage) FROM EmpDetails)
ORDER BY [Max Wage] DESC