Re: Extract only maximum date from column

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Extract only maximum date from column
Date: 2025-12-04 20:18:14
Message-ID: 41346178-2096-8b3a-42d2-1b60a1edb8d@appl-ecosys.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 4 Dec 2025, Ron Johnson wrote:

> May not be the only way, but it's how I do it:
> SELECT *
> FROM foo
> WHERE some_dt = (SELECT MAX(some_dt) FROM foo);
>
> It might return more than one row...

Ron,

Didn't quite work for me this way:

select p.person_nbr, p.company_nbr, c.next_contact
from people as p, contacts as c
where c.next_contact (select max(c.next_contact) from c.contacts) >= '2025-11-01'
group by p.person_nbr, p.company_nbr
order by p.person_nbr, p.company_nbr;

Thanks,

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2025-12-04 20:22:31 Re: Extract only maximum date from column
Previous Message Rich Shepard 2025-12-04 20:13:49 Re: Extract only maximum date from column