Archives of the TeradataForum
Message Posted: Thu, 29 Oct 2009 @ 12:12:12 GMT
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.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 23 Jun 2019|