Query to get max and second max in oracle in one query ?
Answer Posted / sunil
select sal from (select dense_rank() over(order by sal) rank
from emp) where rank in(1,2);
In above query you will get both highest and second highest
salary details even there are more people who are getting
highest and second highest salary.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
6. Display the client name and order date for all orders using the traditional method.
How to create a new table by selecting rows from another table?
What is the use of file param in imp command?
What is blob datatype?
Can we use bind variables in oracle stored procedure?
Explain the use of tables option in exp command.
How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?
What is merge statement used for?
Please explain joins in oracle?
How to load a large xml file?
State the difference between a primary key and foreign key?
How to sort the query output in oracle?
How to get the Installed Oracle Version Information ?
Explain do view contain data?
How to create tables for odbc connection testing?