Re: Copying data from one table to another

From: Richard Huxton <dev(at)archonet(dot)com>
To: Erwin Van de Velde <erwin(dot)vandevelde(at)ua(dot)ac(dot)be>, pgsql-general(at)postgresql(dot)org
Subject: Re: Copying data from one table to another
Date: 2004-02-28 16:40:26
Message-ID: 200402281640.26882.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday 28 February 2004 16:08, Erwin Van de Velde wrote:
>
> I have to copy data from one table to another, and I was wondering if there
> is an easier way to do that than to have a lot of inserts one after
> another.

> Is there a trick to let the INSERT
> command take more than one tuple at once?

Think in sets. As long as you can define the conditions for copying rows:

INSERT INTO table2 SELECT * FROM table1 WHERE somefield='some value';

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karl O. Pinc 2004-02-28 20:38:08 Triggers per transaction, workaround? prospects?
Previous Message Björn Lundin 2004-02-28 16:29:51 Re: Copying data from one table to another