One table with EmpSalary in Employee Table. I need to find the second largest Salary what is paid by the company.?
How to find the Second largest value(Salary) from a table.?
One table with EmpSalary in Employee Table. I need to find the second largest Salary what is paid by the company.?
How to find the Second largest value(Salary) from a table.?
;WITH CTE AS ( SELECT ROW_NUMBER() OVER (ORDER BY SortColumn DESC) AS RowNumber, *
FROM YourTable)
SELECT * FROM CTE WHERE RowNumber = 2
Try this: this should give the second largest salary:
SELECT MAX(EmpSalary) FROM employee WHERE EmpSalary < (SELECT MAX(EmpSalary) FROM employee);
select top(1) prodMrp from Product where not prodMrp = (select top(1) prodMrp from Product order by prodMrp DESC ) order by prodMrp DESC