window function and order by

From: Torsten Förtsch <torsten(dot)foertsch(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: window function and order by
Date: 2013-12-20 20:46:26
Message-ID: 52B4ACA2.9020907@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

assuming I have a query that computes a running sum like this:

select id, buy_price, sum(buy_price) over (order by id) sum
from fmb
where 202300<=id and id<=202400
order by id;

Do I need the ORDER BY clause at the end? Or does the ORDER BY in the
window function already define the order of the result set?

Thanks,
Torsten

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Kregloh 2013-12-20 22:01:47 Re: pg_upgrade & tablespaces
Previous Message Adrian Klaver 2013-12-20 19:57:52 Re: pg_upgrade & tablespaces