Re: Accumulated sums in SQL query
От | Kabai József |
---|---|
Тема | Re: Accumulated sums in SQL query |
Дата | |
Msg-id | 001801c27e61$6b8dfc70$6b01a8c0@audiobox.hu обсуждение исходный текст |
Ответ на | Re: Accumulated sums in SQL query (Christoph Haller <ch@rodos.fzk.de>) |
Список | 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 bankaccount, 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@rodos.fzk.de> To: <kabai@audiobox.hu> Cc: <pgsql-sql@postgresql.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 >
В списке pgsql-sql по дате отправления: