Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 12 Nov 2003 @ 23:07:47 GMT


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


Subj:   Aggregation in UPDATE statement
 
From:   Swarnapuri, Vinod

Hello All,

I am getting the following error when using an aggregate function in the update statement.

UPDATE  table1
FROM    table2
SET     val = SUM(table2.val)
WHERE
        table1.field = table2.field

3872 Illegal use of an aggregate operation in an UPDATE statement.

Explanation: An UPDATE statement includes an aggregate function such as SUM, MIN, etc. in the assignment list.

Generated By: OPT modules.

For Whom: End User.

Remedy: Correct the request and resubmit the


In Oracle, I was using the following statement to achieve the same

UPDATE table1
SET val = (SELECT SUM(val) FROM table2 where table2.field_name = table1.field_name)

Please let me know correct way to write the SQL to get the final result.


Regards,

Vinod Swarnapuri



     
  <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