Re: nth_value and row_number in a partition

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)com>
Cc: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: nth_value and row_number in a partition
Date: 2018-01-25 18:43:34
Message-ID: CAKFQuwa3SCRhpnjOK0=dNxL=vt2Lvrs9VYLhJ8p2UZrUqieShQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday, January 25, 2018, Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Olivier Leprêtre 2018-01-25 19:49:25 RE: nth_value and row_number in a partition
Previous Message Olivier Leprêtre 2018-01-25 18:30:53 nth_value and row_number in a partition