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
Is foreign key unique?
Which are the two editions in which SQL Azure database available?
What is report snapshot in ssrs?
what is a self join? : Sql server database administration
What is the difference between rank and dense_rank?
How to list all field names in the result set using mssql_field_name()?
What are the advantages of using stored procedures?
Can foreign key be duplicate?
What do mean by xml datatype?
What is the Control Flow in SSIS
What protocol does sql server use?
Can you explain what are commit and rollback in sql?
Can you name a few encryption mechanisms in sql server?
Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
What is dirty page?