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 / belson gnana pradeep

Select Top 1 salary from (Select TOP 2 salary from tbl_salary order by salary desc)a order by salary

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is 1nf 2nf?

554


What is surrogate key? : sql server analysis services, ssas

699


When would you prefer to have a minimum number of indexes?

507


What is the difference between a local and a global temporary table?

625


Can we store videos inside the sql server table?

521






How many servers can we create in a single subscription?

146


What is set nocount on and what is set nocount off?

515


How do I start and stop sql server?

550


What is the difference between value type and reference type?

555


What is the use of toad or sqldbx.?

724


After creating the cube, if we added a new column to the oltp table then how you add this new attribute to the cube? : sql server analysis services, ssas

572


I have all the primary data files, secondary data files as well as logs. Now, tell me can I still restore the database without having a full backup? : sql server database administration

681


I applied Transactional with updatable subscriptions replication on 2 tables now i want to delete those 2 tables but i cannot delete those tables as replication is running how can i stop replication for those 2 tables(but i don't want to delete those replicated tables but i need to stop the replication) how can i do that

1443


List the advantages of using stored procedures?

563


How to list all triggers in the database with sys.triggers in ms sql server?

538