I have a table that contains column [Month/Year], [Date], [Volume]
When i run this query "select [Month/Year], [date], sum([Volume]) as 'sum' from VOLUME where [Month/Year] = '2018-10-01' group by [Month/Year], [date] order by [date]", it will show this:
[Month/Year] [Date] [Volume]
2018-10-01 2018-10-15 2000
2018-10-01 2018-10-16 4000
2018-10-01 2018-10-17 7000
2018-10-01 2018-10-18 6000
2018-10-01 2018-10-19 7000
2018-10-01 2018-10-20 7000
2018-10-01 2018-10-21 8000
2018-10-01 2018-10-22 9000
2018-10-01 2018-10-23 11000
2018-10-01 2018-10-24 10000
2018-10-01 2018-10-25 13000
2018-10-01 2018-10-26 12000
2018-10-01 2018-10-27 8000
2018-10-01 2018-10-28 8000
2018-10-01 2018-10-29 9000
2018-10-01 2018-10-30 8000
When i run this query, it give me this output which is wrong:
select a.[date], SUM(b.[Volume]) as barge_sum
from VOLUME a
INNER JOIN VOLUME b ON a.[date] >= b.[date]
where a.[Month/Year] = '2018-10-01'
group by a.[date]
order by a.[date]
Output:
2018-10-15 4000
2018-10-16 24000
2018-10-17 91000
2018-10-18 114000
2018-10-19 182000
2018-10-20 231000
2018-10-21 328000
2018-10-22 450000
2018-10-23 671000
2018-10-24 710000
2018-10-25 1092000
2018-10-26 1152000
2018-10-27 832000
2018-10-28 896000
2018-10-29 1089000
2018-10-30 1032000
The output should be cumulative in this manner:
What am i doing wrong? Can anyone assist?