Re: Accumulated sums in SQL query

From: "Kabai Jzsef" <kabai(at)audiobox(dot)hu>
To: "Christoph Haller" <ch(at)rodos(dot)fzk(dot)de>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Accumulated sums in SQL query
Date: 2002-10-28 09:07:18
Message-ID: 001801c27e61$6b8dfc70$6b01a8c0@audiobox.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks, but it seems not to be the solution to me, the example was not good enough. The table for example represents a bank account, records are debits and credits, and I need the balance in the new query:
D&C balance
---------------
1 1
3 4
-2 2
5 7
-3 4
3 7 and so on

regards Joseph

----- Original Message -----
From: "Christoph Haller" <ch(at)rodos(dot)fzk(dot)de>
To: <kabai(at)audiobox(dot)hu>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Monday, October 28, 2002 9:20 AM
Subject: Re: [SQL] Accumulated sums in SQL query

> > Which is the simplest way to create an SQL query to get accumulated
> sums of
> > records like this (from the table containing the numbers):
> >
> > number sums
> > ---------------
> > 1 1
> > 2 3
> > 3 6
> > 4 10
> >
> SELECT number, SUM(your_sum_column) FROM your_table
> GROUP BY number ;
>
> Regards, Christoph
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2002-10-28 12:27:18 Re: Accumulated sums in SQL query
Previous Message Christoph Haller 2002-10-28 08:20:31 Re: Accumulated sums in SQL query