Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 91F25475C7C for ; Tue, 27 Aug 2002 23:36:17 -0400 (EDT) Received: from www.cdrbill.com (cpe-gan-68-101-90-90-cmcpe.ncf.coxexpress.com [68.101.90.90]) by postgresql.org (Postfix) with ESMTP id C7784475974 for ; Tue, 27 Aug 2002 23:36:16 -0400 (EDT) Received: from jaguar.cdrbill.com (lynx [192.168.0.6]) by www.cdrbill.com (8.11.6/8.11.6) with ESMTP id g7S3aEg04473 for ; Tue, 27 Aug 2002 23:36:14 -0400 Content-Type: text/plain; charset="us-ascii" From: Chris Ruprecht Organization: CDRBill To: pgsql-php@postgresql.org Subject: How do I get the rec-id from an insert. Date: Tue, 27 Aug 2002 23:40:17 -0400 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200208272340.17513.chris@cdrbill.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/104 X-Sequence-Number: 1449 Hi all, I have 3 tables: a: a.recid a.name b: b.recid b.address b.city c: c.recid c.arecid c.brecid each has a default sequence on their respective recid - which is the primar= y=20 index. when I do an "insert into a ...", it automagically assigns recid a new, uni= que=20 value, same goes for b. But to create c, I need to know the recid from a and b, so I can connect th= e=20 two. Is there any way to get the recid from a and b after they have been inserte= d=20 like in "insert into a ... and give me the recid you're going to use, back"? I know, I can do a "netxval('...')" stuff and then insert the records with= =20 values in recid, but that requires two extra calls to the DB per transactio= n. Best regards, Chris --=20 Chris Ruprecht Network Grunt and bitpusher extraordinaire