i need department wise top 2 employees salary.which logic
i will use

Answer Posted / manish gupta

select deptno,sal from (select * from emp order by sal
desc) where rownum<3
union
select deptno,sal from (select * from emp order by sal
desc) where rownum<3 and deptno not in(20);


considering scott table in db.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is delimiter sql?

704


how to select first 5 records from a table? : Sql dba

693


What are instead of triggers?

791


What is oracle sql developer?

788


What sql does db2 use?

726






what is foreign key? : Sql dba

754


How do I count rows in sql query?

690


Define select, insert, create, delete, update, drop keywords

776


Which is better join or subquery?

793


how can I make a script that can be bi-language (supports english, german)? : Sql dba

730


How do you get column names only for a table (sql server)?

859


How do I view stored procedures?

739


Can you select everything, but 1 or 2 fields, without writer's cramp?

691


Explain dml and ddl?

740


Which one is better sql or oracle?

703