adspace
can anybody tell us, how to select 2nd max salary from
table.
my id is ashish.akk@gmail.com
Answer Posted / syaam
select a.sal from emp a
where 2=(select count(distinct b.sal) from emp b
where a.sal<= b.sal)
for getting nth max sal ..replace 2 by n
all the best
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?
Can one drop a column from a table?
How can we solve concurrency problems?
explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
How do I find query history in sql server?
Why and when do stored procedure recompile?
Explain “row_number()” in sql server with an example?
do you know how to configure db2 side of the application? : Sql server database administration
How do I create a trace in sql server?
What is normalization and what are the advantages of it?
When should you use an instead of trigger?
Is it possible to have clustered index on separate drive from original table location?
How to provide default values to function parameters?
List the ways in which dynamic sql can be executed?
Explain system functions or built-in functions? What are different types of system functions?