Query to get max and second max in oracle in one query ?
Answer Posted / lokanath
select * from emp a where 2 > (select count(distinct sal)
from emp b where b.sal > a.sal)
or else use Top Window functions (or) Analatical functions
select * from
(
select empno,ename,sal,rank() over (order by sal desc)
test from emp
)
where test <= 2
| Is This Answer Correct ? | 12 Yes | 4 No |
Post New Answer View All Answers
What is oracle database client?
Explain how are indexes update?
How do we get field details of a table?
What is define in oracle?
How to write a query with a right outer join in oracle?
How would you change old and new values in an insert, delete and update triggers?
In Oracle Clinical 4.5.0, can the VIEW_TEMPLATE_ID column in DATA_EXTRACT_VIEWS table contain NULL value?
Explain implicit cursor.
What are temporal data types in oracle?
Query to retrieve record for a many to many relationship ?
hey friends, What are the steps I can do to transfer the database from Microsoft Access 2003 to oracle10g (or SQL) Best regards
Her departmandaki isçilerden empno' su ikinci sirada olan isçilerin empno, deptno, hiredate, sira_no bigilerini döndüren sorguyu yaziniz?
Can sub procedure/function be called recursively?
Is java required for oracle client?
What is the implicit cursor in oracle?