Archives of the TeradataForum
Message Posted: Tue, 02 Jun 2009 @ 19:30:05 GMT
Subj: | | Re: Syntax for Cumulative Sum |
|
From: | | Michael Larkins |
Teradata has recommended to stay away from the older/original OLAP functions that use GROUP BY for partitioning the data. It has been told
that they skew data during their execution and are therefore not as efficient as the newer ANSI functions.
So instead of using CSUM, you should use SUM/OVER:
SEL SUM( OVER (ORDER BY [ASC | DESC]
[ [ASC | DESC].... ROWS UNBOUNDED PRECEDING)
FROM
If you need to cause a break to occur you use the PARTITION BY prior to the ORDER BY.
Hope this helps,
Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
|