Re: nth_value out of more than n values returns null

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Guyren Howe <guyren(at)gmail(dot)com>
Cc: Erik Wienhold <ewie(at)ewie(dot)name>, PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: nth_value out of more than n values returns null
Date: 2024-11-04 23:44:24
Message-ID: CAKFQuwZH2C=itB7h=S+0UiG5k=U4PsdaLKxsWenZ7GWFdAsDxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, November 4, 2024, Guyren Howe <guyren(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guyren Howe 2024-11-04 23:46:08 Re: nth_value out of more than n values returns null
Previous Message Guyren Howe 2024-11-04 23:38:05 Re: nth_value out of more than n values returns null