Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 26 Jan 2005 @ 23:11:28 GMT


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


Subj:   Re: Self Join within an Update
 
From:   Vanole, Mike

You can try an UPDATE FROM:

     update targetdb.targettable
     FROM
     (
     SELECT  B.ASSOC_DISCOUNT_DOLLARS,
                       B.TRXN_DATE,
                       B.SHOP_NBR,
                         B.SHOP_FLAG,
                             A.ASSOC_DISCOUNT_DOLLARS,
                       A.TRXN_DATE,
                       A.SHOP_NBR,
                       A.SHOP_FLAG
     FROM LNYQDATA.TDSHPTRXN_ASSOCIATE_DISC_TMP1    A,
                 LNYQDATA.TDSHPTRXN_ASSOCIATE_DISC_TMP1  B ,
                 LNYQDATA.DYCALNDR   D
     WHERE  A.TRXN_DATE BETWEEN 1040201 AND 1050129
     AND       A.SHOP_NBR   = B.SHOP_NBR
     AND       A.TRXN_DATE  = D.ACTIVITY_DATE
     AND       D.FISC_LAST_YEAR_DAY = B.TRXN_DATE
     ) XXXXXX (ADDL, TD, SN, SF, ADD2 , TD2, SN2, SF2)

     SET   targetdb.targettable.col1 = ADDL,
           targetdb.targettable.col2 = TD,
           targetdb.targettable.col3 = SN,

     where targetdb.targettable.ADDL2 = ????
       and targetdb.targettable.TN = ???
       and targetdb.targettable.SN2 = ???;

Or something like this.



     
  <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