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 / sudip mondal

select top 1 from employee where ID in (select top2 ID from
employee order by Salary desc) order by Salary asc

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the meaning of sql server?

617


How to create a Master database in SQL server ?

641


What are the acid properties?

635


Explain what is “asynchronous” communication in sql server service broker?

586


What is sparse columns of sql server 2008?

692






How to generate create procedure script on an existing stored procedure?

594


How do I partition a table in sql server?

624


Data table as parameter in sql server?

652


What is the difference between stored procedure and user defined functions?

720


Where sql server usernames and passwords are stored in a sql server?

574


What is the importance of three tier architecture?

704


What is command parameter in ssrs?

130


If a table does not have a unique index, can a cursor be opened on it?

598


What do you mean by SQL injection attack?

717


Explain about SQL server 2005?

638