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
Can group functions be used in the order by clause in ms sql server?
Do I need a report server to run reports in my application?
hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail
What is rtm version in sql server?
How to divide query output into multiple groups with the group by clause in ms sql server?
What method is used by the Command classes to execute SQL statements that return single values?
What is transact-sql ddl trigger?
Explain partitioned view?
What is #table in sql server?
What are the new scripting capabilities of ssms? : sql server management studio
What is unique key constraint?
what are the reporting service components in SSRS?
What is the purpose of the model database?
What is query cost in sql server?
What happens if null values are involved in boolean operations?