Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 29 Oct 2009 @ 12:12:12 GMT


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


Subj:   Re: Nested Aggregates & CSUM
 
From:   Victor Sokovin

  Ideally I would like to do a CSUM (Monthly Runtime) but I get the nested aggregate error. I would appreciate any suggestions  


I think you can rewrite the statement as one GROUP BY if you use the following generic observation: CSUM of COUNTs is the same as CSUM of "indicators".

Indicator, here, is the mathematical lingo for the function defined in the following way:

     Ind(x) = 1, if x is not null;
     Ind(x) = 0, otherwise.

Or, you can modify the definition according to your data model and conventions for COMMISSION_DATE.

You can code this function using CASE.

I'll just add the obligatory pitch that CSUM has been supposed to be decommissioned and its use in new apps is not encouraged. Try to switch to the window version of SUM.


Victor



     
  <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: 23 Jun 2019