I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answer Posted / devi
Get data to internal table from database table using select query.
Sort the second internal table by ascending order.
Then use Delete adjacent duplicates comparing highest marks.
It will remove duplicate highest marks.
Then sort the internal table by descending order.
Read internal table into workarea index 2.
It will give the second highest mark.
Some times we have to process more steps using all data's. At that time we have to create two internal table with same structure . Move the data from firs table to second table and do the above steps.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to sort the query output with order by clauses in ms sql server?
Write a sql query to delete duplicate records from a table called table1
Explain the architecture of ms sql reporting service?
Can a unique index be created on a column, which contains null?
What is sql server used for?
What is lookup override?
What is difference between getdate and sysdatetime in sql server 2008?
What does it mean to invest in the index?
Recommend an approach to ensuring that all changes in the remote databases synchronize with the SQL Azure database?
Is truncate autocommit?
Find columns used in stored procedure?
How to rebuild indexes with alter index ... Rebuild?
What is the difference between insensitive and scroll cursor?
Explain the steps to use transact-sql cursor?
What is ssrs?