Home Page for the TeradataForum

Archives of the TeradataForum

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

  <Prev Next>  
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)
        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.


Vinod Swarnapuri

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020