Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkChL-0001YV-7j for pgsql-general@arkaria.postgresql.org; Thu, 17 Jan 2019 18:47:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkChK-0008Rq-2Q for pgsql-general@arkaria.postgresql.org; Thu, 17 Jan 2019 18:47:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkChJ-0008Oq-N2 for pgsql-general@lists.postgresql.org; Thu, 17 Jan 2019 18:47:25 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkChH-00060t-3b for pgsql-general@lists.postgresql.org; Thu, 17 Jan 2019 18:47:24 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id AB79099353 for ; Thu, 17 Jan 2019 10:47:21 -0800 (PST) Date: Thu, 17 Jan 2019 10:47:21 -0800 (PST) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Refining query statement In-Reply-To: <57b49280-c415-f304-f0b5-3b76d8627cc9@aklaver.com> Message-ID: References: <9a5976c8-76da-f06d-9840-5dcf8723e38b@gmx.net> <7cbcfe0e-813e-b25e-f90e-dbf1e04f5076@aklaver.com> <57b49280-c415-f304-f0b5-3b76d8627cc9@aklaver.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: Precedence: bulk On Thu, 17 Jan 2019, Adrian Klaver wrote: > It would produce results, so yes it would work. The question are they the > results you want? Adrian, To which the answer is no as I just discovered. > The above would return anything with a next_contact less then today. That > could extend backwards to some undetermined point in the past, depending > on how diligent you where on updating next_contact. Before you go much > further I would look over the suggestions posted and then sit down with > pen and paper and figure out what it you want to track and how you are > going to maintain that tracking. Then draw up an outline of how you will > achieve that in code. I have that tracking defined (who is active and needs a contact today or earlier) and am now working on how to code it so only the last contact for a person is examined to determine if the active column = true. I'll ponder that. Thanks, Rich