Re: INSERT... WHERE

Поиск
Список
Период
Сортировка
От Ian Lawrence Barwick
Тема Re: INSERT... WHERE
Дата
Msg-id CAB8KJ=he+ZfrRpDEpmxs6Fi5M-t0qYgpJJrAA6vMPu+pvCwVcg@mail.gmail.com
обсуждение исходный текст
Ответ на INSERT... WHERE  (Robert James <srobertjames@gmail.com>)
Ответы Re: INSERT... WHERE
Список pgsql-general
2013/1/14 Robert James <srobertjames@gmail.com>:
> I have a lot of VALUES I want to INSERT.  But only a subset of them -
> only those that meet a JOIN criteria involving another table.
>
> I could INSERT them into a temp table, and then do a SELECT INTO.  But
> do I need to do that?  Is there any way to do a INSERT... VALUES ...
> WHERE...

INSERT INTO ... SELECT is what you are looking for.

Simple example:

  CREATE TABLE seltest (id INT);
  INSERT INTO seltest (id) SELECT 1;


HTH

Ian Lawrence Barwick


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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: INSERT... WHERE
Следующее
От: Edson Richter
Дата:
Сообщение: Re: Linux Distribution Preferences?