Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 26 Jan 2005 @ 22:56:00 GMT


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


Subj:   Self Join within an Update
 
From:   Crisafulli, Ronald

I'm trying to update a data row in a table with data from a different row in the same table. I can simulate the process in a "select statement using a self join as indicated in the following SQL:

     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
     order by 2,3;

But what I need to do is apply this to an UPDATE request if possible. Is there any way to initiate a SELF JOIN in the UPDATE request. I don't know of any but thought someone out their might. Any ideas are welcome.

Thanks.

Ron
Ron Crisafulli
IT, DBA Manager
New York and Company



     
  <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