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
What privilege is needed for a user to connect to oracle server?
What is a oracle database?
Is the After report trigger fired if the report execution fails ?
How do I uninstall oracle 11g?
How to create a server parameter file?
How do I call oracle stored procedures that take no parameters?
How do I manually uninstall oracle client?
If any one has information regarding interview of NIC (National Informatics Centre),it would be of great help...
How to create a temporary table in oracle?
How to insert a record into a table?
Give the various exception types.
What is a table index?
What is object data modeling?
How to get a list of all user accounts in the database?
What is sequence?