I need to obtain the rows which having same column value from the following table, I tried it the following way, but it gives me a single row only.
select *
from employee e
group by e.empsalary
having count(e.empsalary) > 1
Table employee
Please suggest me a way.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With