Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain about Joins?

955


How to create a view on an existing table in ms sql server?

1081


Why use cursor in sql server?

1032


Explain the flow of creating a cube? : sql server analysis services, ssas

1023


Can a database be shrunk to 0 bytes, if not, why?

1057


How do I open a .db file?

990


How do users use Report Builder with SQL Server data sources?

152


What is updatable resultset?

960


Explain tablesample?

969


What are system databases in ms sql server?

999


What is sub-query in sql server? Explain its properties.

1056


What is federation member?

114


What is the difference between resultset and resultsetmetadata?

912


What is the use of floor function in sql server?

1050


What are the properties and different types of sub-queries?

972