Received: from netsystems.fr (du-fr1-0986.claranet.fr [212.43.203.224]) by hub.org (8.9.3/8.9.3) with SMTP id LAA94229 for ; Fri, 10 Dec 1999 11:44:41 -0500 (EST) (envelope-from eric@netsystems.fr) Received: (qmail 5344 invoked by uid 1000); 10 Dec 1999 16:49:35 -0000 Sender: eric@venus.fondation To: Stuart Rison Cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] INSERT and SELECT References: Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit From: Eric BARROCA Date: 10 Dec 1999 17:49:35 +0100 In-Reply-To: Stuart Rison's message of "Fri, 10 Dec 1999 16:31:32 +0000 (GMT)" Message-ID: <87emcuu4f4.fsf@venus.fondation> Lines: 38 X-Mailer: Gnus v5.6.45/XEmacs 21.1 - "Bryce Canyon" Stuart Rison writes: > INSERT INTO table VALUES SELECT oid, 'test' FROM membre WHERE > email="toto@toto.com"; I've tried it, but it doesn't work too ("paser error near or at select"), even if I replace " by '. The sample table "table" : - ID int4 - login varchar() - password varchar() I'd like to put into the ID culumn the result of (SELECT ...), into the login column "test" and into the password one "testpass". I've tried many queries like : INSERT INTO table (id, login, password) VALUES SELECT oid, 'test', 'testpass' FROM membre WHERE email='toto@toto.com'; or INSERT INTO table (id, login, password) VALUES ((SELECT oid FROM membre WHERE email='toto@toto.com'), 'test', 'testpass'); or INSERT INTO table (id, login, password) VALUES (SELECT oid, 'test', 'testpass' FROM membre WHERE email='toto@toto.com'); ... But nothing give me a result. I get always parse error near select, and I can't figure why. Best Regards, Éric.