rolling window without aggregation - Mailing list pgsql-sql

From Huang, Suya
Subject rolling window without aggregation
Date
Msg-id D83E55F5F4D99B4A9B4C4E259E6227CD1F66FC6A@AUX1EXC02.apac.experian.local
Whole thread
Responses Re: rolling window without aggregation
List 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

pgsql-sql by date:

Previous
From: Gerardo Herzig
Date:
Subject: Re: Querying with arrays
Next
From: David G Johnston
Date:
Subject: Re: rolling window without aggregation