Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 02 Jun 2009 @ 19:30:05 GMT


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


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



     
  <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