public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: dfgpostgres <[email protected]>
Cc: [email protected]
Subject: Re: How to select avg(select max(something) from ...)
Date: Tue, 18 Feb 2025 19:10:06 -0500
Message-ID: <CAKAnmm+yfxQF1c_BvB83s5tShcxNiwc0iP5Wxfy_ti2fVVRvoA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAAcmDX8Xs5+NbSV1UGUsj06yQpC=wYj_FOfTMZNvFe6uXDTqcw@mail.gmail.com>
	<[email protected]>

Another variation:

select avg(max) from (select distinct max(val) over(partition by id) from
mytable);


Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: How to select avg(select max(something) from ...)
  In-Reply-To: <CAKAnmm+yfxQF1c_BvB83s5tShcxNiwc0iP5Wxfy_ti2fVVRvoA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox