I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answer Posted / dinesh gupta
4th highest salary
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY
grosssalary desc) AS salaryno , *
FROM (
select distinct grosssalary
from salarydetails where inmon='dec' and inyear = 2007
) as a
) As T
WHERE t.salaryno = 4
3rd lowest salary
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY
grosssalary ) AS salaryno , *
FROM (
select distinct grosssalary
from salarydetails where inmon='dec' and inyear = 2007
) as a
) As T
WHERE t.salaryno = 3
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Explain about Joins?
How to create a view on an existing table in ms sql server?
Why use cursor in sql server?
Explain the flow of creating a cube? : sql server analysis services, ssas
Can a database be shrunk to 0 bytes, if not, why?
How do I open a .db file?
How do users use Report Builder with SQL Server data sources?
What is updatable resultset?
Explain tablesample?
What are system databases in ms sql server?
What is sub-query in sql server? Explain its properties.
What is federation member?
What is the difference between resultset and resultsetmetadata?
What is the use of floor function in sql server?
What are the properties and different types of sub-queries?