Home Page for the TeradataForum
 
https:

Archives of the TeradataForum

Message Posted: Mon, 02 Apr 2007 @ 21:54:51 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Teradata Join condition with case statement
 
From:   Wu, Judy

How about use 3-way joins as follows.

First, create a table C (a2, a3, a4, a5,a6, a7) and insert one row with the following values('2A', '3A', 4A', '5A', '6A', 7A')

Then use the query ==>

     Insert into A_acc_sp(...)
     Select ... From A_acc_p Left join B_acc_tmp ON
     (A_acc_sp .acc_col_1,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a2) OR
     (A_acc_sp .acc_col_2,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a3) OR
     (A_acc_sp .acc_col_3,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a4) OR
     (A_acc_sp .acc_col_4,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a5) OR
     (A_acc_sp .acc_col_5,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a6) OR
     (A_acc_sp .acc_col_,B_acc_tmp.acc_id) = (B_acc_tmp.acc_cd, C.a7) ;

Judy Wu



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020