Re: nth_value out of more than n values returns null - Mailing list pgsql-general

From Guyren Howe
Subject Re: nth_value out of more than n values returns null
Date
Msg-id 34536f21-801c-41cb-a5ba-5389ce8201d0@Spark
Whole thread Raw
In response to Re: nth_value out of more than n values returns null  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: nth_value out of more than n values returns null
List pgsql-general
Wouldn’t it be offset 4_999_999?

I’d still like to understand why nth_value doesn’t work.
On 4 Nov 2024 at 15:44 -0800, David G. Johnston <david.g.johnston@gmail.com>, wrote:
On Monday, November 4, 2024, Guyren Howe <guyren@gmail.com> wrote:
I’m trying to get the id of the 5,000,000th record, so I can join against it to get a name. I didn’t fully understand what the docs say there. What am I missing?

So just use “offset 5_000_000 limit 1”.  Bringing in a window function here seems unhelpful.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: nth_value out of more than n values returns null
Next
From: "David G. Johnston"
Date:
Subject: Re: nth_value out of more than n values returns null