Re: Selecting table row with latest date

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Selecting table row with latest date
Date: 2021-08-19 14:45:58
Message-ID: alpine.LNX.2.20.2108190741170.15165@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 19 Aug 2021, David G. Johnston wrote:

> Select distinct on (person_nbr) ….. order by person_nbr, contact_date
> desc;

David,

Please clarify: would this produce the most recent contact_date for each
person_nbr? The manual reads that two rows (e.g., for the same person_nbr)
are considered distinct if they differ in any one column (e.g.,
contact_dates).

Still confused.

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2021-08-19 14:47:40 Re: Selecting table row with latest date
Previous Message Adrian Klaver 2021-08-19 14:42:57 Re: Selecting table row with latest date