How to do this in SQL?

Поиск
Список
Период
Сортировка
От Chris Bitmead
Тема How to do this in SQL?
Дата
Msg-id 3700E388.3E3A77E1@bigfoot.com
обсуждение исходный текст
Ответы Re: [GENERAL] How to do this in SQL?  (Stuart Rison <stuart@ludwig.ucl.ac.uk>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Statistical Solutions
Дата:
Сообщение: Re: [GENERAL] Performance
Следующее
От: Stuart Rison
Дата:
Сообщение: Re: [GENERAL] How to do this in SQL?