Search code examples
sqlsumteradatapartition

summing in sections -teradata sql


I have a data set separated by date for example,

date          value
10/30/2015      0
10/30/2015      0
10/30/2015      3
10/30/2015      0
10/30/2015      0
1/28/2018       0
1/28/2018       0
1/28/2018       3 
1/28/2018       0
1/28/2018       0

and I need to sum these values and sort them into dates so my desired resulting table would be

date          value
10/30/2015       3
1/28/2018        3

I wasn't sure if I needed to use "rows unbounded preceding" or if I could just sum over date or something similar.

thank you


Solution

  • What if i am using GROUP BY with SUM ?

    select date, sum(value) as value
    from table t
    group by date
    order by date;