Re: Select into

From: Richard Huxton <dev(at)archonet(dot)com>
To: beyaRecords - The home Urban music <uzo(at)beya-records(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Select into
Date: 2004-01-12 09:45:18
Message-ID: 200401120945.18759.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

  • Select into at 2004-01-12 01:09:43 from beyaRecords - The home Urban music

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2004-01-12 09:52:53 Re: Unique key field or serverl fks ?
Previous Message azwa 2004-01-12 09:12:11 Insert into