On Wed, Dec 31, 2008 at 4:34 PM, Pavel Stehule <pavel.steh...@gmail.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers