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 / radhakrishnan vaithilingam
SELECT TOP 1 id.salary
FROM (SELECT TOP 2 id,salary
FROM employee
ORDER BY salary DESC )a
ORDER BY a.salary ASC
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?
What is outer join in sql server joins?
What is mssql?
List layers of abstraction microsoft architectured to provide relational db through cloud platform ?
what is the system function to get current user's user id? : Sql server database administration
What do you understand by a stored procedure?
Explain about sql server login?
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?
What you can do to delete a table without the delete trigger firing?
Other than truncate statement, which other command can by-pass the trigger on the tables?
What is t-sql script to take database offline – take database online.
Describe how to use linked server?
what's the information that can be stored inside a bit column? : Sql server database administration
You are creating an application where users are asked their gender in the gender combo box you have three options: ‘male’ , ‘female’ and ‘i choose not to disclose’ these options are stored in the table as 1, 0 or null which datatype should you use?
Do you know what is sql service broker?