Archives of the TeradataForum
Message Posted: Wed, 12 Nov 2003 @ 23:07:47 GMT
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.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|