Re: Functionally dependent columns in SELECT DISTINCT
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Willow Chargin <postgresql@wchargin.com>
Cc: "shammat@gmx.net" <shammat@gmx.net>, "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2024-09-13T15:43:54Z
Lists: pgsql-general
On Friday, September 13, 2024, Willow Chargin <postgresql@wchargin.com> wrote: > In reality I really do want the ID columns of the > *most recent* items. > Use a window function to rank them and pull out rank=1, or use a lateral subquery to surgically (fetch first 1) retrieve the first row when sorted by recency descending. David J.