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

query on CSUM - response (2) by vuyyuru05

$
0
0

Hi Dieter,
 
the table data is like below.
Date                             Name                      Measure
2013-07-01                    A                            10
2013-07-01                    B                            5
2013-07-01                    C                            2
2013-07-02                    A                            4
2013-07-02                    C                            2
2013-07-03                    A                             15
2013-07-03                    D                              8
 
My output  should be like below:
name              mesure              date             CUM_AMT
A                     10                   7/1/2013         10
A                       4                   7/2/2013          14
A                     15                   7/3/2013         29

B                        5                   7/1/2013         5
B                        0                    7/2/2013         5
B                        0                    7/3/2013         5

C                        2                      7/1/2013       2
C                        3                      7/2/2013       3
C                        0                       7/3/2013      5

D                        0                       7/1/2013        0
D                        0                          7/2/2013      0
D                        8                         7/3/2013      8

like this so on... i have to get the cumulative sum for the dates which are not present in source table also...My source table is having 139 M records..
help me out in writing sql....
Regards,
Ramaiah


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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