From: | "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec> |
---|---|
To: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: sum() over (partition by order) question |
Date: | 2008-12-31 22:26:39 |
Message-ID: | 3073cc9b0812311426i7335201aqee10345043c1f460@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 31, 2008 at 4:34 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> Hello
>
> I am play with windows function. I was surprised so these queries has
> different results.
>
> postgres=# select sum(a) over (partition by b), a, b from foo;
AFAIUI, this means one sum per b value, the result in the sum column
will be equivalent to "select sum(a) from foo group by b"
>
> postgres=# select sum(a) over (partition by b order by a), a, b from foo;
and this means something like accumulate the value of a per b value
and for every value of b accumulate per a value... maybe this can be
described better...
don't know exactly if we can imitate this behaviour without window functions
--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-12-31 22:57:45 | Re: sum() over (partition by order) question |
Previous Message | Pavel Stehule | 2008-12-31 22:19:14 | Re: sum() over (partition by order) question |