Re: nth_value and row_number in a partition - Mailing list pgsql-sql

From David G. Johnston
Subject Re: nth_value and row_number in a partition
Date
Msg-id CAKFQuwa3SCRhpnjOK0=dNxL=vt2Lvrs9VYLhJ8p2UZrUqieShQ@mail.gmail.com
Whole thread Raw
In response to nth_value and row_number in a partition  (Olivier Leprêtre <o.lepretre@gmail.com>)
Responses RE: nth_value and row_number in a partition
List pgsql-sql
On Thursday, January 25, 2018, Olivier Leprêtre <o.lepretre@gmail.com> wrote:

nth_value(integer, bigint) doesn't exists.  

This is close, you just need to cast to integer. 

(cast(row_number() as integer)  over (partition by roads,segments order by orders))) 

You cannot separate the window function from its over clause.

Cast( Row_number() over (...) as integer )

Not tested...and I tend to use :: instead of cast

David J.

pgsql-sql by date:

Previous
From: Olivier Leprêtre
Date:
Subject: nth_value and row_number in a partition
Next
From: Olivier Leprêtre
Date:
Subject: RE: nth_value and row_number in a partition