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 C4779D76E4 for ; Wed, 31 Aug 2005 12:10:05 -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 66529-08 for ; Wed, 31 Aug 2005 15:09:55 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by svr1.postgresql.org (Postfix) with ESMTP id A8E50D7292 for ; Wed, 31 Aug 2005 12:09:54 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i4so130546wra for ; Wed, 31 Aug 2005 08:09:54 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=bi+PZq12taqw+WNhxUsinu6UeIIoiRuxY10EOP/OOKu1ywTUoZeE2z5W9+6fxGso82gFt2iSwvG3Rgn3LG27MimkVS6AQGgjG0yecvIshfKDMF5TNWSefc2bFnlkPAeauD55n9i3u4OwuV9f5pfp/PlG6d+vAzMZWNikHZa8KR8= Received: by 10.54.139.19 with SMTP id m19mr737545wrd; Wed, 31 Aug 2005 08:09:54 -0700 (PDT) Received: by 10.54.124.5 with HTTP; Wed, 31 Aug 2005 08:09:54 -0700 (PDT) Message-ID: <2bffcc33050831080942f806e1@mail.gmail.com> Date: Wed, 31 Aug 2005 11:09:54 -0400 From: Henry Ortega To: pgsql-sql@postgresql.org Subject: insert only if conditions are met? Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3622_2189365.1125500994514" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 required=5 tests=[AWL=-0.313, HTML_10_20=0.295, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200508/308 X-Sequence-Number: 22536 ------=_Part_3622_2189365.1125500994514 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Is there a way to insert a record only if a certain condition is met? Something like: insert into employee values('lastname','firstname',8) where (condition here.. select sum(ofsomething) from xx where sum(ofsomething)>0 = ) Is this possible at all with just plain SQL? ------=_Part_3622_2189365.1125500994514 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Is there a way to insert a record only if a certain
condition is met?

Something like:
insert into employee values('lastname','firstname',8) where
(condition here.. select sum(ofsomething) from xx where sum(ofsomething)>= ;0 )

Is this possible at all with just plain SQL?
------=_Part_3622_2189365.1125500994514--