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
How to modify the underlying query of an existing view?
what is package and it uses and how can u call a package
Is sql server a database?
Difference between aggregate functions of sql?
Explain mixed authentication mode of sql server?
What is a matrix in ssrs?
What are the differences between substr and charindex in sql server.
How do I open port 1433?
Can we use trigger new in before insert?
Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you
Is sql different from sql server?
What is merge statement?
Explain about SQL server 2005?
How many partitions a clustered index has by default in sql server 2012?
Mention the uses of stored procedures.