From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Robert James <srobertjames(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: INSERT... WHERE |
Date: | 2013-01-14 02:22:50 |
Message-ID: | CAOR=d=1cC7MYRTmB5T=tPvmNoxZhkPu_DOJJ9qBNSXLk4xh7uQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Jan 13, 2013 at 7:00 PM, Robert James <srobertjames(at)gmail(dot)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;
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Lawrence Barwick | 2013-01-14 02:29:21 | Re: INSERT... WHERE |
Previous Message | Lonni J Friedman | 2013-01-14 02:05:01 | special procedure required when running pg_basebackup from a standby? |