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 1gkB8K-0005PI-HB for pgsql-general@arkaria.postgresql.org; Thu, 17 Jan 2019 17:07:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkB8I-0000AY-D6 for pgsql-general@arkaria.postgresql.org; Thu, 17 Jan 2019 17:07:10 +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 1gkB8I-0000AO-1l for pgsql-general@lists.postgresql.org; Thu, 17 Jan 2019 17:07:10 +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 1gkB8F-0003VL-FX for pgsql-general@lists.postgresql.org; Thu, 17 Jan 2019 17:07:08 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 3D18D99353 for ; Thu, 17 Jan 2019 09:07:06 -0800 (PST) Date: Thu, 17 Jan 2019 09:07:06 -0800 (PST) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Refining query statement In-Reply-To: Message-ID: References: <9a5976c8-76da-f06d-9840-5dcf8723e38b@gmx.net> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 17 Jan 2019, David G. Johnston wrote: > Yes...though now it just sounds like a flawed data model. David, This is what I thought. > How stuck are you in that regard? Those "future" contacts should have their > own records and not be derived via an optional field on an existing > record. My goal is to make a functioning business tracking application for my consulting services. Almost all my prior postgres databases hold environmental data for statistical and spatio-temporal analyses so writing a business application is a new experience for me and I want to get it correct. > Put differently, how do you know which activities are completed and > which are not? The direct answer is that a completed activity has a row with either a future next-activity date or a null (which is the case when the status of that organization or contact is 'no further contact'.) I should rename the Contacts table as People and the Activities table as Contacts. The original names came from a sales management system I used as a design guide, but they're probably confusing to others as well as to me. :-) I can provide my current schema (eight tables) to the list (perhaps as an attachment), an individual, or put in on a cloud site and pass the URL. Thanks, Rich