Received: from tech.com.au (IDENT:root@techpt.lnk.telstra.net [139.130.75.122]) by hub.org (8.9.2/8.9.1) with ESMTP id KAA49377 for ; Tue, 30 Mar 1999 10:05:19 -0500 (EST) (envelope-from chris.bitmead@bigfoot.com) Received: from bigfoot.com (chris@localhost [127.0.0.1]) by tech.com.au (8.8.7/8.8.7) with ESMTP id BAA12232; Wed, 31 Mar 1999 01:03:38 +1000 Sender: chris@tech.com.au Message-ID: <3700E7C9.FCD0D4C5@bigfoot.com> Date: Tue, 30 Mar 1999 15:03:37 +0000 From: Chris Bitmead X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: Herouth Maoz CC: pgsql-sql@postgreSQL.org Subject: Re: [GENERAL] How to do this in SQL? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Herouth Maoz wrote: > INSERT INTO BOOK (name, author) > SELECT 'War and Peace', oid > FROM author > WHERE name = 'Tolstoy'; Thanks! Now what if I had... CREATE TABLE book (author oid, publisher oid); What is the syntax? Is it... INSERT INTO BOOK(author, publisher) SELECT author.oid, publisher.oid FROM author, publisher WHERE author.name = 'Tolstoy' AND publisher.name = 'Penguin'; Is that right? -- Chris Bitmead http://www.bigfoot.com/~chris.bitmead mailto:chris.bitmead@bigfoot.com