Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGqCO-0000Zb-AP for pgsql-general@arkaria.postgresql.org; Thu, 19 Aug 2021 22:07:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mGqCM-0007cs-S8 for pgsql-general@arkaria.postgresql.org; Thu, 19 Aug 2021 22:07:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGqCM-0007cd-Io for pgsql-general@lists.postgresql.org; Thu, 19 Aug 2021 22:07:42 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGqCK-0006Vf-9N for pgsql-general@lists.postgresql.org; Thu, 19 Aug 2021 22:07:41 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 7DDC22A0108 for ; Thu, 19 Aug 2021 15:07:37 -0700 (PDT) Date: Thu, 19 Aug 2021 15:07:37 -0700 (PDT) From: Rich Shepard To: "pgsql-general@lists.postgresql.org" Subject: Re: Selecting table row with latest date [RESOLVED] In-Reply-To: Message-ID: References: <1704154.1629384082@sss.pgh.pa.us> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) 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, 19 Aug 2021, David G. Johnston wrote: > Well, in this case I suspect you had made a different mistake which caused > the error message (probably the max(c.next_contact)) but instead of > solving the original problem (removing the max(...)) you decided that two > wrongs (adding or extending a group by) would hopefully make a right > (which it did, technically). But while the query works it is definitely > not conceptually correct. David, I'm not at all surprised as I use postgres infrenquently. Once I have queries producing results I need for my business tracking or client data I just use them. I'm neither a professional DBA nor database developer and use a variety of technical applications dependent on project needs. And I'm quite used to being chastised by those who work primarily with a single application all day every day and I accept that I'm not an expert. Regards, Rich