Re: INSERT... WHERE

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: INSERT... WHERE
Дата
Msg-id CAOR=d=1cC7MYRTmB5T=tPvmNoxZhkPu_DOJJ9qBNSXLk4xh7uQ@mail.gmail.com
обсуждение исходный текст
Ответ на INSERT... WHERE  (Robert James <srobertjames@gmail.com>)
Список pgsql-general
On Sun, Jan 13, 2013 at 7:00 PM, Robert James <srobertjames@gmail.com> wrote:
> 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...

What you're probably looking for is an insert .. select statment like so:

insert into tablea (col1, col2, col3) select colx, coly, colz from
tableb where somecondition;


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

Предыдущее
От: Lonni J Friedman
Дата:
Сообщение: special procedure required when running pg_basebackup from a standby?
Следующее
От: Ian Lawrence Barwick
Дата:
Сообщение: Re: INSERT... WHERE