Hi all,
I am using SQL 2005 Express, I have a table like this,
Table Name : Employee
Eid Name Salary
1 harry 3500 2 jack 2500 3 john 2500 4 xavier 5500 5 steven 7500 6 susana 2400
I would like to select the nth maximum salary in this table, and suppose if there is 100 records in this table, i want to select 10th maximum salary.
I want the single query answer.(if it is possible)
Can anyone help me?
Thanks in Advance
|
| Author: Ritesh N. Jain 28 Aug 2008 | Member Level: Gold | Rating: Points: 2 |
Try this query
SELECT TOP 1 salary FROM (SELECT TOP 10 salary FROM EmployeeORDER BY salary desc ) Empsalary Order by salary asc
|
| Author: http://venkattechnicalblog.blogspot.com/ 31 Aug 2008 | Member Level: Diamond | Rating: Points: 3 |
select Eid, name,salary from (select row_number() (over salary) as rno,Eid,name,salary from Employee) t where rno=10
Regards, Venkatesan Prabu .J
|