Thread: Concatenate two tables

Concatenate two tables

From
Alexander Pucher
Date:
Hi,

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

mfg
alex

--
________________________________________________________

Institut fuer Geographie und Regionalforschung
Universitaet Wien
Kartografie und Geoinformation

Departement of Geography and Regional Research
University of Vienna
Cartography and GIS

Universitaetstr. 7, A-1010 Wien, AUSTRIA

Tel: (+43 1) 4277 48644
Fax: (+43 1) 4277 48649
E-mail: alexander.pucher@univie.ac.at

FTP: ftp://ftp.gis.univie.ac.at
WWW: http://www.gis.univie.ac.at/karto
--------------------------------------------------------
Virtual Map Forum: http://www.gis.univie.ac.at/vmf
--------------------------------------------------------

M$ is not the answer. M$ is the question!
No is the answer -- Eric Naggum



Re: Concatenate two tables

From
Harry
Date:
On Sun, 08 Dec 2002 22:38:40 +0100
Alexander Pucher <pucher@atlas.gis.univie.ac.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

Re: Concatenate two tables

From
Oliver Elphick
Date:
On Sun, 2002-12-08 at 21:38, Alexander Pucher wrote:
> Hi,
>
> I have two tables with identical table stucture. How can i add all rows
> from table2 into table1, i.e concatenate the two tables.

INSERT INTO table1 (SELECT * FROM table2);

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "For I am the LORD your God; ye shall therefore
      sanctify yourselves, and ye shall be holy; for I am
      holy."          Leviticus 11:44