On Thu, 4 Dec 2025, David G. Johnston wrote:

So:
Select person.*, lastcontact.*
from people
join lateral (select contacts.*
     from contacts
     where contacts.person_nbr = people.person_nbr
     order by last_contact_date
     desc limit 1)
as lastcontact on true;

I was giving you a query form. You should use the actual table and column
names in your schema…

David,

The two table names are 'people' and 'contacts', the columns are
'person_nbr' and 'last_contact.' I usually use aliases rather than the table
name to reference the column.

Rich


Reply via email to