From: Guillaume Lelarge <guillaume@lelarge.info>
To: Nicholas I <nicholas.domnic.i@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: insert into help
Date: Wed, 22 Sep 2010 09:35:20 +0200
Message-ID: <4C99B1B8.6040607@lelarge.info> (raw)
In-Reply-To: <AANLkTi=1-bAfOTtpkgrTGmDioKetTud2aKwBNup3_raE@mail.gmail.com>
References: <AANLkTi=1-bAfOTtpkgrTGmDioKetTud2aKwBNup3_raE@mail.gmail.com>
Le 22/09/2010 09:32, Nicholas I a écrit :
> Hi,
>
> i have two tables,
> ---------------------------------------------------------------
> *table1
>
> id type serial, name varchar;*
> *--------------------------------------------------------------
> table 2
>
> name varchar;*
> ---------------------------------------------------------------
>
> i want to insert the values of table 2 into table 1, with automatic id's.
>
> insert into table1(select * from table2);
>
> is not working, how can i append the data to table 1 with auto incremented
> or nextval.
>
INSERT INTO table1 (name) SELECT name FROM table2;
--
Guillaume
http://www.postgresql.frhttp://dalibo.com
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: guillaume@lelarge.info, nicholas.domnic.i@gmail.com
Subject: Re: insert into help
In-Reply-To: <4C99B1B8.6040607@lelarge.info>
* 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