X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5FF3BD857A for ; Wed, 31 Aug 2005 13:36:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86646-04 for ; Wed, 31 Aug 2005 16:36:46 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 68F6ED852F for ; Wed, 31 Aug 2005 13:36:40 -0300 (ADT) Received: from adsl3-5-241.du.simnet.is ([157.157.204.241] [157.157.204.241]) by quasar.skima.is with ESMTP; Wed, 31 Aug 2005 16:36:36 Z Subject: Re: insert only if conditions are met? From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Henry Ortega Cc: pgsql-sql@postgresql.org In-Reply-To: <2bffcc3305083108497ea6dcc6@mail.gmail.com> References: <2bffcc33050831080942f806e1@mail.gmail.com> <20050831152534.GA18934@winnie.fuhr.org> <2bffcc3305083108487fb80cb2@mail.gmail.com> <2bffcc3305083108497ea6dcc6@mail.gmail.com> Content-Type: text/plain Date: Wed, 31 Aug 2005 16:44:58 +0000 Message-Id: <1125506698.2605.22.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[AWL=0.000] X-Spam-Level: X-Archive-Number: 200508/313 X-Sequence-Number: 22541 On Wed, 2005-08-31 at 11:49 -0400, Henry Ortega wrote: > What I am trying to do is > * Insert a record for EMPLOYEE A to TABLE A > IF > the sum of the hours worked by EMPLOYEE A on TABLE A > is not equal to N > > Is this possible? Sure, given a suitable schema It is not clear to me, if the hours worked are to be found in the same table you want to insert into, or not. gnari