rolling window without aggregation

From: "Huang, Suya" <Suya(dot)Huang(at)au(dot)experian(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: rolling window without aggregation
Date: 2014-12-05 07:25:17
Message-ID: D83E55F5F4D99B4A9B4C4E259E6227CD1F66FC6A@AUX1EXC02.apac.experian.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi SQL experts,

I've got a question here, is that possible to implement a window function without aggregation? Any SQL could get below desired result?

For example:

Table input
date | id
------------+--------
2014-04-26 | A
2014-05-03 | B
2014-05-10 | C
2014-05-17 | D
2014-05-24 | E
2014-05-31 | F

Expected output, use 2 week roll up as an example:
date | id
------------+--------
2014-04-26 | A
2014-05-03 | A
2014-05-03 | B
2014-05-10 | B
2014-05-10 | C
2014-05-17 | C
2014-05-17 | D
2014-05-24 | D
2014-05-24 | E
2014-05-31 | E
2014-05-31 | F

Thanks,
Suya

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G Johnston 2014-12-05 07:35:28 Re: rolling window without aggregation
Previous Message Gerardo Herzig 2014-12-04 19:56:18 Re: Querying with arrays