Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 04 Jun 2007 @ 12:25:18 GMT


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


Subj:   Re: 7547: Target row updated by multiple source rows
 
From:   Dieter Noeth

Hopefully you got several cups of tea/coffee within the last 4 days ;-)

Just put the QUALIFY into a Derived Table:

     UPDATE TEA_MAKING
     FROM
       (
        SELECT * 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
       ) AS TEA_MADE
     SET
        MADE_QT = TEA_MADE.MADE_QT,
        INCLUDE_COFFEE_IN=TEA_MADE.INCLUDE_COFFEE_IN
     WHERE
        TEA_MAKING.MAKER_NM=TEA_MADE.MAKER_NM
     ;

Dieter



     
  <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