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