Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 16 Nov 2005 @ 18:06:46 GMT


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


Subj:   Re: UPDATE vs DELETE-INSERT
 
From:   Micheletto, David

If table1 is the target of many(?) updates, perhaps an insert select like the following might work better? (check the logic out carefully)

     INSERT newtable
     SELECT a.col1, a.col2,
            case when b.col1 is null then a.col3
                 else b.col3 end,
            case when b.col1 is null then a.col4
                 else b.col4 end
     from  table1 a left join table2 b
     on    a.col1 = b.col1
     and   a.col2 = b.col2

David L. Micheletto
Senior Instructor
Teradata Certified Master



     
  <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: 15 Jun 2023