Re: Denormalizing during select

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Edmund Lian <no(dot)spam(at)address(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Denormalizing during select
Date: 2003-03-01 17:07:06
Message-ID: 1046538423.26763.178.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)rbt(dot)ca>

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-03-01 17:07:14 Re: Epoch extraction
Previous Message Rod Taylor 2003-03-01 17:07:04 Re: Denormalizing during select