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
What is delimiter sql?
how to select first 5 records from a table? : Sql dba
What are instead of triggers?
What is oracle sql developer?
What sql does db2 use?
what is foreign key? : Sql dba
How do I count rows in sql query?
Define select, insert, create, delete, update, drop keywords
Which is better join or subquery?
how can I make a script that can be bi-language (supports english, german)? : Sql dba
How do you get column names only for a table (sql server)?
How do I view stored procedures?
Can you select everything, but 1 or 2 fields, without writer's cramp?
Explain dml and ddl?
Which one is better sql or oracle?