pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: beyaRecords - The home Urban music <uzo@beya-records.com>
To: pgsql-sql@postgresql.org
Subject: Re: Select into
Date: Mon, 12 Jan 2004 09:45:18 +0000
Message-ID: <200401120945.18759.dev@archonet.com> (raw)
In-Reply-To: <010CB3A9-449C-11D8-9778-0003938366A4@beya-records.com>
References: <010CB3A9-449C-11D8-9778-0003938366A4@beya-records.com>

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



view thread (43+ messages)  latest in thread

Message-ID: <200401120945.18759.dev@archonet.com>
Permalink:  ../200401120945.18759.dev@archonet.com/
Also on:    postgresql.org/message-id/200401120945.18759.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, uzo@beya-records.com
  Subject: Re: Select into
  In-Reply-To: <200401120945.18759.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox