View Single Post
  #3 (permalink)  
Old 05-24-2006, 01:59 AM
alexfr alexfr is offline
Junior Member
 
Join Date: May 2006
Posts: 24
alexfr is on a distinguished road
Default SQL 99 answer. Re: Create a third row that make the sum of past row + current row (i.e. a running sum)?

Nearly the same but last column is current total + previous like :
week total t
1 5 5
2 6 11
3 5 16
[sql]
select t2.week, t2.total, sum(t1.total)
from MY_TABLE T1, MY_TABLE T2
where T1.WEEK <=t2.week
group by t2.week, T2.total
order by t2.week asc
[/sql]
Reply With Quote