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

From Tom Lane
Subject Re: Nested window functions not permitted
Date
Msg-id 9838.1447023012@sss.pgh.pa.us
Whole thread Raw
In response to Nested window functions not permitted  (Oliver Elphick <olly@lfix.co.uk>)
Responses Re: Nested window functions not permitted
List pgsql-general
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


pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Nested window functions not permitted
Next
From: Oliver Elphick
Date:
Subject: Re: Nested window functions not permitted