Re: Extract only maximum date from column

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Extract only maximum date from column
Дата
Msg-id 841faf53-7f95-18b6-35-71516db8ca1e@appl-ecosys.com
обсуждение исходный текст
Ответ на Re: Extract only maximum date from column  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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



В списке pgsql-general по дате отправления: