"David G. Johnston" <[email protected]> writes:
> On Fri, May 5, 2023 at 6:55 AM Sky Lendar <[email protected]> wrote:
>> Notice that 12 is missing in the list.

> Since your DISTINCT ON *subquery* doesn't specify an ordering which of
> those two are chosen as the representative record for M31 is
> non-determinstic.

> If you want to ensure the lowest valued nb is chosen you need to sort the
> *subquery*.

The "weather_reports" example here might help clarify this for you:

https://www.postgresql.org/docs/current/sql-select.html

                        regards, tom lane


Reply via email to