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 language is sql server written in?
What does top operator do?
What is query processing?
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
Explain what is cte (common table expression)?
What is a trigger what are the advantages of trigger?
Can select statements be used on views in ms sql server?
explain different types of constraints? : Sql server database administration
Can a table have 2 foreign keys?
How global temporary tables are represented and its scope?
Explain log shipping and mention its advantages.
What are system databases in ms sql server?
How do I determine how many instances of sql server are installed on a computer?
What are sql server functions?
Why are you getting errors when creating a new odbc dsn?