Select Find Nth Highest Salary Record In Sql ServerVKvasanth krishna13yAsked Aug 7, 2013, 11:13 PM3k Select Find Nth Highest Salary Record In Sql Server
Sandeep Singh Shekhawat13y agoPosted Aug 8, 2013, 1:02 AMAccepted answerhttp://www.c-sharpcorner.com/UploadFile/3d39b4/find-nth-highest-salary-in-sql-server/0
Anurag Sarkar13y agoPosted Aug 8, 2013, 12:21 AMYou can use MAX function for this Query will be like this only.select MAX(Salary) from Employee;For more move here:- http://blog.sqlauthority.com/2008/03/12/sql-server-2005-find-nth-highest-record-from-database-table-using-ranking-function-row_number/Thanks.0
IHIftikar Hussain13y agoPosted Aug 8, 2013, 12:19 AMHi, Try like thisusing Row_Number--find 3rd higest salaryselect EmpId,EmpName,SalaryFROM(select ROW_NUMBER() OVER(ORDER BY Salary desc) as RowNo, *from Employee ) As dataWHERE data.RowNo=3using TOP--find 6th higest salarySELECT TOP 1 EmpId,EmpName,SalaryFROM (SELECT DISTINCT TOP 6 Salary,EmpId,EmpNameFROM EmployeeORDER BY salary DESC) aORDER BY salaryRegards,Iftikar0
Abhineet Srivastava13y agoPosted Aug 7, 2013, 11:31 PMCheck this link:http://www.programmerinterview.com/index.php/database-sql/find-nth-highest-salary-sql/0
Sandeep Singh ShekhawatPosted Aug 8, 2013, 1:02 AM
Anurag SarkarPosted Aug 8, 2013, 12:21 AM
select MAX(Salary) from Employee;
For more move here:- http://blog.sqlauthority.com/2008/03/12/sql-server-2005-find-nth-highest-record-from-database-table-using-ranking-function-row_number/
Thanks.
Iftikar HussainPosted Aug 8, 2013, 12:19 AM
Try like this
using Row_Number
Regards,
Iftikar
Abhineet SrivastavaPosted Aug 7, 2013, 11:31 PM
http://www.programmerinterview.com/index.php/database-sql/find-nth-highest-salary-sql/