Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Rewriting the Self join - response (2) by ulrich

$
0
0

 

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
             ) 

 

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>