Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

MSUM - use column name for query width - forum topic by sam99

$
0
0

Hi All,
 
This is my requirement.
PDay        Query_width    Sal    Sum of last '3' rows inclusive
9/13/2013    3        10    10
9/14/2013    3        20    30
9/15/2013    3        30    60
9/16/2013    3        40    90
9/17/2013    3        50    120
9/18/2013    3        60    150
9/19/2013    3        70    180
MSUM(sal,3,PDay)
 
The issue here is the value query_width can change each time. Hence could I use the col name instead of hardcode value 3?
MSUM(sal,query_width,PDay)
 
Please share your thoughts.
 
Regards,
Sam

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>