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 1mH3m9-0008C5-Cy for pgsql-general@arkaria.postgresql.org; Fri, 20 Aug 2021 12:37:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mH3m6-0000du-Qp for pgsql-general@arkaria.postgresql.org; Fri, 20 Aug 2021 12:37:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mH3m6-0000Z7-Gp for pgsql-general@lists.postgresql.org; Fri, 20 Aug 2021 12:37:30 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mH3m3-0005Vk-ES for pgsql-general@lists.postgresql.org; Fri, 20 Aug 2021 12:37:29 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id AA3962A0108 for ; Fri, 20 Aug 2021 05:37:25 -0700 (PDT) Date: Fri, 20 Aug 2021 05:37:25 -0700 (PDT) From: Rich Shepard To: pgsql-general Subject: Re: Selecting table row with latest date In-Reply-To: Message-ID: References: <1704154.1629384082@sss.pgh.pa.us> <446C1708-2523-4A9F-B5EC-221BFF2D851E@gmail.com> 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 Fri, 20 Aug 2021, Francisco Olarte wrote: > Is your next_contact really dependent on the contact record ( > person+contact_date? ). Francisco, Yes. > I mean, your tables seem CRM like. You stated next_contact for old > contacts is not interesting. It seems next_contact is associated just > by a person, something like this: Not true. The history of contacts is highly valuable. > Is the nc for the previous record useful for anything ? ( It seems to be > nor useful for calling, but you may want to do reports to see next-contact > correlation with the contacts on another records ) Yes. > To me, and maybe others, it seems there is only one valid next-contact > date, potentially null, which should go in the person record, and may be > the contacts table should capture the value of next-contact at the time > the contact was made for analysis. This also makes finding contacts to be > made soon easier. That's because you don't know my business: I'm currently in my twenty-ninth year as a consultant helping clients avoid and resolve environmental issues and have long ago found what information I need and use to efficiently run my business. Regards, Rich