You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Samuel Williams <sp...@gmail.com> on 2012/09/28 15:32:08 UTC

Re: Running total?

Hi Alex,

Will your suggested approach give me a running balance such as on a bank
statement with a list of transactions?

Kind regards,
Samuel

On 31 July 2012 18:12, Alexander Shorin <kx...@gmail.com> wrote:

> Hi,
>
> Depends on your data, but just emit transaction id from set as key and
> his amount as value with map and _sum these values with reduce
> function. If you need totals for all set, then emit [set_id, item_id]
> key and group results by specific level.
>
> --
> ,,,^..^,,,
>
>
> On Tue, Jul 31, 2012 at 6:38 AM, Samuel Williams
> <sp...@gmail.com> wrote:
> > Hi,
> >
> > Given a set of transactions with each transaction having an integer
> amount
> > or something similar, is it possible to generate a running total for each
> > transaction using map-reduce in CouchDB?
> >
> > Kind regards,
> > Samuel
>