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
What stored by the msdb? : sql server database administration
what is an extended stored procedure? : Sql server database administration
what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
What is the difference between varchar and varchar(max) datatypes?
How to loop through result set objects using odbc_fetch_row()?
Describe in brief authentication modes in sql server.
How do I setup a sql server database?
Sql server reporting services vs. Crystal reports.
What are the advantages dts has over bcp?
What do you mean by normalisation?
why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it? : Sql server administration
Explain different types of collation sensitivity?
How can you insert values in multiple rows using one Insert statement?
What is difference between views and stored procedures?
Explain transaction server explicit transaction?