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 / sanjay

create table test(id int identity,marks int)
insert into test
select 20
union all
select 31
union all
select 33
union all
select 1
union all
select 3
union all
select 100
union all
select 88

select * from test


with data as
(
select marks,row_number() over(order by marks desc) as rno
from test
)
select * from data where rno = 3

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can group functions be used in the order by clause in ms sql server?

1017


Do I need a report server to run reports in my application?

165


hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail

2226


What is rtm version in sql server?

1057


How to divide query output into multiple groups with the group by clause in ms sql server?

1044


What method is used by the Command classes to execute SQL statements that return single values?

1073


What is transact-sql ddl trigger?

1112


Explain partitioned view?

1087


What is #table in sql server?

1046


What are the new scripting capabilities of ssms? : sql server management studio

1068


What is unique key constraint?

1065


what are the reporting service components in SSRS?

163


What is the purpose of the model database?

1018


What is query cost in sql server?

998


What happens if null values are involved in boolean operations?

987