query to find the 10th maximum salary

Please support our MS SQL advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 12
Reputation: superhuman is an unknown quantity at this point 
Solved Threads: 0
superhuman superhuman is offline Offline
Newbie Poster

query to find the 10th maximum salary

 
0
  #1
Feb 22nd, 2007
Query to find the 10th maximum salary from an employees table which contains empno,empname,empsal as columns.If this table contains n number of records,how to determine the 10th maximum salary
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: query to find the 10th maximum salary

 
0
  #2
Feb 23rd, 2007
there's probably a more efficient way but this should work
select max(empsal) from employees where empno not in (select top 3 empno from employees order by empsal desc)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC