hi frends....
i want to calculate the second max sal?
how can i?
can we use 'count' for that?
Printable View
hi frends....
i want to calculate the second max sal?
how can i?
can we use 'count' for that?
In SQL server
[B]select max(sal) from employee where sal not in (select max(sal) from employee)[/B]
we are using sub queries for this scenario. First of all we are eliminating the record which has the maximum salary. This is done by not in operator. From the rest of the records if we fetch the maximum salary, that is the second highest salary
----------------------
suresh
select max(salary) from kani where salary not in
(select top 1 salary from kani order by salary desc)