Re: Select into - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Select into
Date
Msg-id 200401120945.18759.dev@archonet.com
Whole thread Raw
In response to Select into  (beyaRecords - The home Urban music <uzo@beya-records.com>)
List pgsql-sql
On Monday 12 January 2004 01:09, beyaRecords - The home Urban music wrote:
> Hi,
> I want to copy a sequence of rows from one table into another table. I
> have tried select into but this will only work if the table you are
> copying to does not already exist. How do I copy to a table that does
> already exist?

Something like:

INSERT INTO table_a (a,b,c)
SELECT d,e,f FROM table_b WHERE f=1;

You could replace any of the columns in the SELECT by an expression if you 
wanted to.

--  Richard Huxton Archonet Ltd


pgsql-sql by date:

Previous
From: azwa@nc.com.my
Date:
Subject: Insert into
Next
From: Richard Huxton
Date:
Subject: Re: Unique key field or serverl fks ?