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 a mixed extent? : Sql server administration
What is primary key, unique key, and foreign key?
Why transaction is important?
What is difference between after and before?
Tell me what are the essential components of sql server service broker?
How to download and install microsoft .net framework version 2.0?
How to delete a login name in ms sql server?
Write the queries for commands like Create Table, Delete table, Drop Table etc.
List the ways in which dynamic sql can be executed?
How much is a sql server license?
What are views in ms sql server?
What is save transaction and save point?
What is a recursive stored procedure in sql server?
What is candidate key with example?
Some queries related to SQL