Second highest salary
How can i find out second highest salary in particular database?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jan 23, 2012, 1:11 AM
For 2nd highest salary
Here n=2
select distinct(salary) from employee A where 2=(select count(distinct(salary)) from employee B where A.salary<=B.salary)
Thanks
Sonakshi SinghPosted Jan 23, 2012, 12:07 AM
Prabhu RajaPosted Jan 22, 2012, 11:58 PM
Try this out , Hope it will help you.
DECLARE @N Int
SET @N = 2
If this post helps you, then mark as "Correct Answer". Thank You
Jignesh TrivediPosted Jan 22, 2012, 11:20 PM
try this
select * from(
SELECT empId, salary,
ROW_NUMBER()OVER(PARTITION BY salary ORDER BY salary desc ) as RowNum
from ExaminationOptions) A
where A.RowNum =n
using the above query u can find n number of highest salary.
hope this help.
Dhaval PatelPosted Jan 20, 2012, 7:12 AM
please use this query