hm, try and check the differences in explain and run times
select A.MERGE_ID,
A.REM_ID,
A.EFF_DT,
A.FIRST_MERGE_DT ,
A.CURR_CUST_MERGE_DT
FROM CUST_HIST A
where exists ( select *
from CUST_HIST B
where A.REM_ID=B.MERGE_ID
)
UNION -- this would make the group by obsolate
select A.MERGE_ID,
A.REM_ID,
A.EFF_DT,
A.FIRST_MERGE_DT ,
A.CURR_CUST_MERGE_DT
FROM CUST_HIST A
where exists ( select *
from CUST_HIST B
where B.REM_ID=A.MERGE_ID
)
hm, try and check the differences in explain and run times