Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 04 Jun 2007 @ 10:44:43 GMT


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


Subj:   Re: 7547: Target row updated by multiple source rows
 
From:   D silva, Joseph Vinish

You were almost there ;)

     UPDATE TGT1
     FROM TEA_MAKING TGT1 ,
     (
     SELECT MAKER_NM, MADE_QT, INCLUDE_COFFEE_IN
     FROM TEA_MADE
     QUALIFY ROW_NUMBER() OVER (PARTITION BY TEA_MADE.MAKER_NM ORDER BY
     TEA_MADE.INCLUDE_COFFEE_IN, TEA_MADE.MADE_QT DESC) = 1
     ) SRC1 (MAKER_NM, MADE_QT, INCLUDE_COFFEE_IN)
     SET
     MADE_QT =+ SRC1.MADE_QT,
     INCLUDE_COFFEE_IN=SRC1.INCLUDE_COFFEE_IN
     WHERE
     TGT1.MAKER_NM=SRC1.MAKER_NM;

Joseph D'silva



     
  <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