X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C92B3A6066 for ; Mon, 13 Dec 2004 16:48:20 +0000 (GMT) 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 85661-05 for ; Mon, 13 Dec 2004 16:48:16 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7DBFB3A6015 for ; Mon, 13 Dec 2004 16:48:15 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBDGmFeK025642; Mon, 13 Dec 2004 11:48:15 -0500 (EST) To: sarlav kumar Cc: pgsql-novice@postgresql.org Subject: Re: INSERT question In-reply-to: <20041213162839.60931.qmail@web51303.mail.yahoo.com> References: <20041213162839.60931.qmail@web51303.mail.yahoo.com> Comments: In-reply-to sarlav kumar message dated "Mon, 13 Dec 2004 08:28:39 -0800" Date: Mon, 13 Dec 2004 11:48:14 -0500 Message-ID: <25641.1102956494@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/83 X-Sequence-Number: 11660 sarlav kumar writes: > Is there a way to write the INSERT as follows? > INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, > (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); > I tried this, but I get the following problem: > ERROR: More than one tuple returned by a subselect used as an expression. INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) SELECT 1203, code, 'true', 1 FROM country WHERE send IS NOT NULL OR receive IS NOT NULL; regards, tom lane