Dear all,
Here's a table:
a b
--- ---
1 1
2 3
3 6
4 10
5 15

how can i perform the cumulative sum of a in the field b, in foxpro
program??

Thanks anyway!

Patrick

Re: cumulative sum of field by borisb

borisb
Thu Oct 13 06:48:10 CDT 2005

PatrickHO@ASC wrote:
>
> Dear all,
> Here's a table:
> a b
> --- ---
> 1 1
> 2 3
> 3 6
> 4 10
> 5 15
>
> how can i perform the cumulative sum of a in the field b, in foxpro
> program??
>
> Thanks anyway!
>
> Patrick
>
>
>

LOCAL lnCumuulativeSum
m.lnCumuulativeSum = 0
SELECT YourTable
SCAN
m.lnCumuulativeSum = m.lnCumuulativeSum + YourTable.A
REPLACE B WITH m.lnCumuulativeSum
ENDSCAN