Re: Copying rows between tables?

From: "Viorel Dragomir" <bc(at)vio(dot)ro>
To: <swampler(at)noao(dot)edu>, "Postgres-SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Copying rows between tables?
Date: 2004-01-13 16:30:47
Message-ID: 061a01c3d9f2$9a253ab0$6500a8c0@wylog.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


----- Original Message -----
From: "Steve Wampler" <swampler(at)noao(dot)edu>
To: "Postgres-SQL" <pgsql-sql(at)postgresql(dot)org>
Sent: Tuesday, January 13, 2004 18:23
Subject: [SQL] Copying rows between tables?

>
> I know I can select from one table into a new table, but is
> there a way to select from one table into an existing table
> (aside from copying everything to a file, editing the file
> and then copying from that file)? Without destroying existing
> entries, of course...

INSERT INTO table1(row1, row2)
SELECT row1, row2 FROM archive_table;

>
> I have an application where old records are archived into
> 'archive' tables. Occasionally there is a need to copy
> some of these old records into the 'active' table.
>
> Thanks for any pointers!
> Steve
> --
> Steve Wampler -- swampler(at)noao(dot)edu
> The gods that smiled on your birth are now laughing out loud.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Reinoud van Leeuwen 2004-01-13 16:32:26 Re: Copying rows between tables?
Previous Message Steve Wampler 2004-01-13 16:23:48 Copying rows between tables?