Hi All,
How we can re write this query in efficient way, this is a replicated case of my original data with standard scott schema emp tables.
SELECT e1.*
FROM emp e1
WHERE EXISTS (
SELECT 1
FROM (
SELECT deptno
, MAX (sal) sal
FROM emp
GROUP BY deptno
) e2
WHERE e2.deptno = e1.deptno
AND e2.sal = e1.sal
)
ORDER BY deptno;