| From: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
|---|---|
| To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Extract only maximum date from column |
| Date: | 2025-12-05 13:41:44 |
| Message-ID: | 841faf53-7f95-18b6-35-71516db8ca1e@appl-ecosys.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2025-12-05 16:04:40 | Re: Extract only maximum date from column [RESOLVED] |
| Previous Message | Thiemo Kellner | 2025-12-05 12:16:20 | Extract only maximum date from column |