Click here to Skip to main content
13,345,954 members (63,936 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 16 Feb 2011

nth Highest Salary in SQL Server 2005

, 16 Feb 2011
Rate this:
Please Sign up or sign in to vote.
SELECT salary FROM TN a 
    WHERE n - 1 = (SELECT COUNT(salary) FROM TN b WHERE b.salary > a.salary)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

India India
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...


Comments and Discussions

GeneralRe: Looks like you have not modified your vote yet. There is sti... Pin
AspDotNetDev22-Feb-11 15:44
protectorAspDotNetDev22-Feb-11 15:44 
GeneralRe: You're right :) *ashamed* I'll modify my vote. Pin
phil.o22-Feb-11 9:17
memberphil.o22-Feb-11 9:17 
GeneralReason for my vote of 1 There are some issues with your quer... Pin
Costica U2-Mar-11 14:55
memberCostica U2-Mar-11 14:55 
GeneralReason for my vote of 1 First, the SQL request you give seem... Pin
phil.o17-Feb-11 6:46
memberphil.o17-Feb-11 6:46 
GeneralRe: I think you are being a little hard here. The Subject says ... Pin
Henry Minute17-Feb-11 15:41
memberHenry Minute17-Feb-11 15:41 
I think you are being a little hard here.

The Subject says 'nth highest salary' not 'the highest'. Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 16 Feb 2011
Article Copyright 2011 by Mohd_Ahmad
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid