I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000
Answer Posted / tusar
select distinct (a.sal),empno from emp a
where &N = (select count (distinct(b.sal))
from emp b where a.sal <= b.sal);
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is replication with database mirroring? : sql server database administration
What stored by the msdb?
Can I save my report as html, excel or word? : sql server management studio
How can I change procedure name in sql server?
How do I view a trc file?
Can we use custom code in ssrs?
What is use of @@ spid in sql server?
What are the different types of join?
write an SQL query to list the employees who joined in the month of January?
Define clusters?
What is cte (common table expression)?
What are the underflow and overflow behaviors on float literals?
What is cube dimension? : sql server analysis services, ssas
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?
How to loop through result set objects using mssql_fetch_array()?