Ashutosh Srivastava
Answered On : Sep 21st, 2007
select * from emp where sal in(
select sal from emp where rowid not in(
select max(rowid) from emp group by sal))

1 User has rated as useful.
Login to rate this answer.
select a.empno,a.ename,a.sal from scott.emp a where a.sal in
(select sal from scott.emp group by sal having count(*)>1)

4 Users have rated as useful.
Login to rate this answer.
hi..
select name,salary from emp e1,emp e2 where e1.esalary=e2.esalary

2 Users have rated as useful.
Login to rate this answer.
select e1.ename,e2.salary from emp e1.emp e2 where
e1.emp_id=e2.emp_id
Login to rate this answer.
SQL> select distinct e.name,e.salary from employe e, employe a
2 where e.salary = a.salary and e.name != a.name;
NAME SALARY
---------- ----------
MANI 10000
SELVAM 10000
SURAJ 10000
KAMAL 20000
RAMESH 20000
SARA 20000
6 rows selected.

4 Users have rated as useful.
Login to rate this answer.
This query display the same salary.
select * from emp
where sal in (select sal from emp
group by sal
having count(1)>1)
Plz let me know in case of any problem
Thanks
Sarath
Login to rate this answer.
Prabakaran
Answered On : Jul 27th, 2011
select * from emp where eid in (select eid from emp groupby emp.sal having count(*)>1)
Login to rate this answer.
vishnu
Answered On : Aug 7th, 2011
select e.ename,e.salary from emp e self join emp s on e.salary =s.salary

1 User has rated as useful.
Login to rate this answer.
jo
Answered On : Aug 9th, 2011
select ename,sal from emp where sal in(select sal from emp group by sal having count(sal)>=2)
Login to rate this answer.
Hello,
try this:
select emp_id, name, salary, rank() over ( order by salary ) from employee;
Login to rate this answer.
select distinct D. Ename,D.SAL from EMP E,EMP D WHERE E.SAL = D.SAL AND E.ENAME <> D.ENAME;
Login to rate this answer.
I think the easiest way is to SELECT A.* FROM EMPLOYEE A, EMPLOYEE B WHERE A.SAL = B.SAl AND A.ROWID <> B.ROWID
Code
SELECT A.* FROM EMPLOYEE A, EMPLOYEE B WHERE A.SAL = B.SAl AND A.ROWID <> B.ROWID
Login to rate this answer.
vikash kumar singh
Answered On : Aug 4th, 2012
Code
SELECT eMployee_Id,First_Name,Last_Name,Salary FROM(SELECT Employee_Id,First_Name,Last_Name,Salary,Count(*) Over (Partition BY Salary ORDER BY Salary) Cnt
FROM Employees) WHERE Cnt>=2;
Login to rate this answer.
Code
SELECT e1.ename,e1.sal,count(*) person_having_same_sal FROM emp e1,emp e2 WHERE e1.sal=e2.sal GROUP BY e1.sal,e1.ename HAVING count(*)>1;
OR
Code
SELECT * FROM emp WHERE sal IN (SELECT sal FROM emp GROUP BY sal HAVING count(*)>1);
OR
Code
SELECT DISTINCT e1.ename,e1.sal FROM emp e1,emp e2 WHERE e1.sal=e2.sal AND e1.ename!=e2.ename;
Login to rate this answer.