Selecting table row with latest date

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

I have a table of contacts (PK is the person_nbr and contact_date) and I
want to select only the row with the latest (most recent) contact_date. The
Comparison Date/Time sections in the postgres 12 doc doesn't appear to have
what I want, and when I try to use the max() aggregate function it throws an
error.

Please point me to the proper place in the docs where I can learn how to do
this.

Rich

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2021-08-19 14:40:19 Re: Selecting table row with latest date
Previous Message Tom Lane 2021-08-19 14:37:19 Re: How to detach a database