Re: Denormalizing during select

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: Denormalizing during select
Дата
Msg-id 1046538423.26763.177.camel@jester
обсуждение исходный текст
Ответ на Re: Denormalizing during select  (Edmund Lian <no.spam@address.com>)
Ответы Re: Denormalizing during select  (Greg Stark <gsstark@mit.edu>)
Список 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@rbt.ca>

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

В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Epoch extraction
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: Denormalizing during select