Can any_value be used like first_value in an aggregate? - Mailing list pgsql-general

From Bruno Wolff III
Subject Can any_value be used like first_value in an aggregate?
Date
Msg-id 20240625164208.GA1043@wolff.to
Whole thread Raw
Responses Re: Can any_value be used like first_value in an aggregate?
List pgsql-general
For example, is output of 10 guaranteed in the following:
bruno=> select any_value(x order by x desc) from generate_series(1,10) as x;
 any_value 
-----------
        10
(1 row)

The use case is that I want to return a value of one column that is paired 
with the maximum value of another column in each group when using GROUP BY.

(There aren't going to be any NULLs in the involved columns.)

Thanks.



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Postgresql python in upgraded version 16.2
Next
From: Tom Lane
Date:
Subject: Re: Can any_value be used like first_value in an aggregate?