Bhavin A. Patil
Grasshopper
Points: 13
More actions
June 5, 2006 at 3:10 am
#172884
i want the query to find "second largest salary" from table.
Ajit-297150
Mr or Mrs. 500
Points: 593
June 6, 2006 at 12:03 am
#641863
select max(sal) from Emp_Salary
where sal not in (select max(sal) from Emp_Salary)
[KH]
SSCommitted
Points: 1908
June 6, 2006 at 11:57 pm
#642191
select min(sal) from (select top 2 sal from Emp_Salary order by sal desc) a
June 6, 2006 at 11:58 pm
#642192
to ignore rows of same sal
select min(sal) from (select distinct top 2 sal from Emp_Salary order by sal desc) a
or
select min(sal) from (select top 2 sal from Emp_Salary group by sal order by sal desc) a
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply