You should be able to accomplish this by joining the table to itself:
SELECT
a.*
FROM
employee a
JOIN employee b
ON a.empsalary = b.empsalary
AND a.empid != b.empid
Use an inner join to join with your query posted.
select A.* from employee A
inner join (
select empsalary
from employee
group by empsalary
having count(*) > 1
) B ON A.empsalary = B.empsalary
Something like this perhaps
SELECT * FROM employee a
WHERE EXISTS (
SELECT 1 FROM employee b
WHERE a.empsalary = b.empsalary
AND a.empid <> b.empid
);
select * from employee where empsalary IN(select empsalary from employee group by empsalary having count(empsalary ) > 1)
Try This.It gives 2 rows as you want.