Re: Selecting table row with latest date - Mailing list pgsql-general

From Rich Shepard
Subject Re: Selecting table row with latest date
Date
Msg-id alpine.LNX.2.20.2108190903050.15165@salmo.appl-ecosys.com
Whole thread Raw
In response to Re: Selecting table row with latest date  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Selecting table row with latest date
Re: Selecting table row with latest date
List pgsql-general
On Thu, 19 Aug 2021, Adrian Klaver wrote:

> Alright now I am confused. You keep referring to contact_date, yet the
> query is referring to next_contact. Are they the same thing, different
> things or other?

Adrian,

The table has 5 columns: person_nbr, contact_date, contact_type, notes, and
next_contact.

I want the query to find all person_nbr whose most recent contact_date has a
next_contact date <= today. I don't need prior contact_dates and their
next_contact dates because some go back several years. I want to know those
I need to contact again based on our most recent contact.

HTH,

Rich



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Selecting table row with latest date
Next
From: "Markhof, Ingolf"
Date:
Subject: string_agg distinct order by