pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: kabai@audiobox.hu
Cc: pgsql-sql@postgresql.org
Subject: Re: Accumulated sums in SQL query
Date: Mon, 28 Oct 2002 09:20:31 +0100
Message-ID: <3DBCF34F.9F6ACBA8@rodos.fzk.de> (raw)

> 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




view thread (3+ messages)  latest in thread

Message-ID: <3DBCF34F.9F6ACBA8@rodos.fzk.de>
Permalink:  ../3DBCF34F.9F6ACBA8@rodos.fzk.de/
Also on:    postgresql.org/message-id/3DBCF34F.9F6ACBA8@rodos.fzk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, kabai@audiobox.hu
  Subject: Re: Accumulated sums in SQL query
  In-Reply-To: <3DBCF34F.9F6ACBA8@rodos.fzk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox