X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A96DBD1EC5A for ; Tue, 23 Mar 2004 20:43:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 80967-04 for ; Tue, 23 Mar 2004 16:43:30 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 61BACD1EBC0 for ; Tue, 23 Mar 2004 16:43:28 -0400 (AST) Received: (qmail 30685 invoked by uid 500); 23 Mar 2004 20:46:30 -0000 Date: Tue, 23 Mar 2004 14:46:30 -0600 From: Bruno Wolff III To: beyaNet Consultancy Cc: pgsql-sql@postgresql.org Subject: Re: SQL Query Message-ID: <20040323204630.GA30663@wolff.to> Mail-Followup-To: beyaNet Consultancy , pgsql-sql@postgresql.org References: <051D7AFC-7D05-11D8-AC21-0003938366A4@ntlworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <051D7AFC-7D05-11D8-AC21-0003938366A4@ntlworld.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/240 X-Sequence-Number: 17339 On Tue, Mar 23, 2004 at 20:02:32 +0000, beyaNet Consultancy wrote: > Hi, > I am trying to create a query which basically goes along the lines of: > > INSERT INTO tableX ( COL1, COL2 ) VALUES ( x, y ) where COL1 !=x and > COL2 !=Y > > So, insert a record into tableX where there is not already an existence > of COL1 and COL2 > > Can this be done as I have described or is there a more efficient way > to do this? > > many thanks > > Peter Pretty much the same question was asked on the admin list (though this list is more appropiate) earlier today. The answer I gave is at: http://archives.postgresql.org/pgsql-admin/2004-03/msg00305.php