Received: from golem.fourpalms.org (www.fourpalms.org [64.3.68.148]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7BGokP38160 for ; Sat, 11 Aug 2001 12:50:46 -0400 (EDT) (envelope-from lockhart@fourpalms.org) Received: from fourpalms.org (localhost.localdomain [127.0.0.1]) by golem.fourpalms.org (Postfix) with ESMTP id 6C615FEB6; Sat, 11 Aug 2001 16:50:45 +0000 (UTC) Message-ID: <3B756265.5820C429@fourpalms.org> Date: Sat, 11 Aug 2001 16:50:45 +0000 From: Thomas Lockhart Reply-To: lockhart@fourpalms.org Organization: Yes X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.17-21mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 To: Joshua Adam Ginsberg Cc: pgsql-general@postgresql.org Subject: Re: Query help... References: <3B751129.7030101@owlnet.rice.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200108/283 X-Sequence-Number: 13526 > I've got three tables that I'm working with... the first is a table of > staff members... firstname, lastname, staffid... nothing tough... the > second is a table of jobs... job title, jobid... nothing tough... the > third is a history of job assignments... it's got a staffid, a jobid, a > timestamp, and a field to denote whether the job was added or dropped... > this third table exists because it is useful in this project to be able > to look at a staff member's job history... ... > Any suggestions? Perhaps not a helpful one... but I would be inclined to reorganize that third table to have a "start date" *and* a "stop date" field, and ditch the "dropped" boolean: o it would keep you from having to figure out how to associate two entries in the same table with the same job (the added and dropped rows). How would you currently prevent a job from being entered as "dropped" without a corresponding "added" row? o it would make it easier to do the query you are asking about; to tell whether someone has an active job, just select on a date -- like 'today' -- between the start and stop dates. o it may better match reality; jobs have a duration so represent that explicitly. hth - Thomas