Re: Nested window functions not permitted - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Nested window functions not permitted
Date
Msg-id 1447023107.4444.29.camel@phoenix
Whole thread Raw
In response to Re: Nested window functions not permitted  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Sun, 2015-11-08 at 17:50 -0500, Tom Lane wrote:
> Oliver Elphick <olly@lfix.co.uk> writes:
> > I tried to do this:
> > SELECT     p.company, p.start, p.yearend, p.idnum,
> >            s.pdno, s.pdend,
> >            CASE WHEN nth_value(s.pdend,(row_number() OVER w)::INTEGER -1) OVER w IS NULL
> >                 THEN p.start
> >                 ELSE nth_value(s.pdend,(row_number() OVER w)::INTEGER -1) + '1 day'::INTERVAL
>
> Um, don't you just want lead() or lag()?
>
>             regards, tom lane

So I do!  Thanks.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Nested window functions not permitted
Next
From: Adrian Klaver
Date:
Subject: Re: Error when test on DBT2 Postgresql