pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: Edmund Lian <no.spam@address.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Denormalizing during select
Date: 01 Mar 2003 12:07:06 -0500
Message-ID: <1046538423.26763.178.camel@jester> (raw)
In-Reply-To: <eq8n5vcad8ut4hk3dba1g4q27c54gr6dbs@4ax.com>
References: <200302241433.49502.josh@agliodbs.com>
	<fhpl5v86vkhq26gifm9g4cb1kh2o2b6d6r@4ax.com>
	<eq8n5vcad8ut4hk3dba1g4q27c54gr6dbs@4ax.com>

On Tue, 2003-02-25 at 13:48, Edmund Lian wrote:
> On Tue, 25 Feb 2003 03:44:02 GMT, Edmund Lian wrote:
> 
> >I found this example in "Practical PostgreSQL"... will it do the job?
> 
> Answering my own question: kind of. The problem with custom aggregates
> is that they need to be used with a "group by" clause, and this means
> that the select cannot return columns that are not aggregates of some
> kind. What I'm trying to return are rows that are a combination of
> columns and aggregates.

I've been trying to figure out how to give a running total (similar
issue I think).

key    	value
1	5
1	5
1	5
2	1
2	2
2	1


Query output:
key	value	sum to point
1	5	5
1	5	10
1	5	15
2	1	1
2	2	3
2	1	4


I think I should be able to do it with an aggregate -- but the best I've
been able to come up with is a Set Returning Function.

-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachments:

  signature.asc (application/pgp-signature, 186B) download

view thread (11+ messages)  latest in thread

Message-ID: <1046538423.26763.178.camel@jester>
Permalink:  ../1046538423.26763.178.camel@jester/
Also on:    postgresql.org/message-id/1046538423.26763.178.camel@jester

 · 

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: rbt@rbt.ca, no.spam@address.com
  Subject: Re: Denormalizing during select
  In-Reply-To: <1046538423.26763.178.camel@jester>

* 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