MERGE_ID is the primary index in CUST_HIST
SELECT * FROM
(SEL A.MERGE_ID,A.REM_ID, A.EFF_DT, A.FIRST_MERGE_DT , A.CURR_CUST_MERGE_DT FROM
CUST_HIST A
INNER JOIN
CUST_HIST B ON A.REM_ID=B.MERGE_ID
UNION ALL
SEL B.MERGE_ID,B.REM_ID, B.EFF_DT, B.FIRST_MERGE_DT , B.CURR_CUST_MERGE_DT FROM
CUST_HIST A
INNER JOIN
CUST_HIST B ON A.REM_ID=B.MERGE_ID )A
GROUP BY 1,2,3,4,5
Is there any other better way to rewrite this.Like duplicating the table with REM_ID as PI.Or else this is fine?
Regards
Bikky
Forums: