Skip site navigation (1) Skip section navigation (2)

Re: Concatenate two tables

From: Harry <h3(at)x-maru(dot)org>
To: Alexander Pucher <pucher(at)atlas(dot)gis(dot)univie(dot)ac(dot)at>,pgsql-novice(at)postgresql(dot)org
Subject: Re: Concatenate two tables
Date: 2002-12-08 22:03:02
Message-ID: 20021208140302.14a0e10d.h3@x-maru.org (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-novice
On Sun, 08 Dec 2002 22:38:40 +0100
Alexander Pucher <pucher(at)atlas(dot)gis(dot)univie(dot)ac(dot)at> wrote:

> I have two tables with identical table stucture. How can i add all rows 
> from table2 into table1, i.e concatenate the two tables.

I think following will accomplish this for you:

	insert into table1 select * from table2;

Or, if you want the concatenation of table1 and table2 in a new table:

	select * into table3 from 
	(select * from table1 union select * from table2) as tmp

-Harry

In response to

pgsql-novice by date

Next:From: Oliver ElphickDate: 2002-12-08 22:08:52
Subject: Re: Concatenate two tables
Previous:From: Alexander PucherDate: 2002-12-08 21:38:40
Subject: Concatenate two tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group