Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query to get employee details for those who have same salary

723563Apr 5 2010 — edited Apr 5 2010
Hi Experts,
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> WITH EMP AS
  2  (
  3  SELECT 1000 EMPNO,100 SAL FROM DUAL UNION ALL
  4  SELECT 1001,90 FROM DUAL UNION ALL
  5  SELECT 1002,80 FROM DUAL UNION ALL
  6  SELECT 1003,90 FROM DUAL UNION ALL
  7  SELECT 1004,100 FROM DUAL UNION ALL
  8  SELECT 1005,20 FROM DUAL UNION ALL
  9  SELECT 1006,10 FROM DUAL
 10  )SELECT * FROM EMP;

     EMPNO        SAL
---------- ----------
      1000        100
      1001         90
      1002         80
      1003         90
      1004        100
      1005         20
      1006         10

7 rows selected.
SQL>
Desired Output:
     EMPNO        SAL
---------- ----------
      1000        100
      1004        100
      1001         90
      1003         90
Please suggest how to work out the query?

Thanks,
This post has been answered by 009 on Apr 5 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2010
Added on Apr 5 2010
5 comments
1,744 views