pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Bitmead <chris.bitmead@bigfoot.com>
To: pgsql-general@postgresql.org
Subject: How to do this in SQL?
Date: Tue, 30 Mar 1999 14:45:28 +0000
Message-ID: <3700E388.3E3A77E1@bigfoot.com> (raw)

Let's say I had a table...
CREATE TABLE book (
   author oid,
   name text );
and...
CREATE TABLE author (
   name text );

and I wanted to create a book pointing to author with name 'Tolstoy'. I
want to do something like...

INSERT INTO book(name,author) values('War and Peace',
      (SELECT oid FROM author WHERE name = 'Tolstoy'));

but this doesn't work. What is the correct syntax?

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com



view thread (5+ messages)  latest in thread

Message-ID: <3700E388.3E3A77E1@bigfoot.com>
Permalink:  ../3700E388.3E3A77E1@bigfoot.com/
Also on:    postgresql.org/message-id/3700E388.3E3A77E1@bigfoot.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: chris.bitmead@bigfoot.com, pgsql-general@postgresql.org
  Subject: Re: How to do this in SQL?
  In-Reply-To: <3700E388.3E3A77E1@bigfoot.com>
  References: <3700E388.3E3A77E1@bigfoot.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox