Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vRFi5-00ASJd-0w for pgsql-general@arkaria.postgresql.org; Thu, 04 Dec 2025 20:13:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vRFi4-004dt2-0V for pgsql-general@arkaria.postgresql.org; Thu, 04 Dec 2025 20:13:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vRFi3-004dse-2d for pgsql-general@lists.postgresql.org; Thu, 04 Dec 2025 20:13:52 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vRFi1-0039wl-2G for pgsql-general@lists.postgresql.org; Thu, 04 Dec 2025 20:13:51 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 827532A14D6 for ; Thu, 4 Dec 2025 12:13:49 -0800 (PST) Date: Thu, 4 Dec 2025 12:13:49 -0800 (PST) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Extract only maximum date from column In-Reply-To: Message-ID: <47e11d37-37b-8341-a0c2-45f1b1b7ca9a@appl-ecosys.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 4 Dec 2025, Bryan Sayer wrote: > I believe in general you need > > having c.next_contact = max(c.next_contact) > > (at least in ANSI SQL) Use having for after the join has occurred Bryan, Postgresql didn't like that regardless of where I inserted the `having' stanza. Thanks, Rich