Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 705781337B69 for ; Wed, 22 Sep 2010 04:35:29 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68802-04 for ; Wed, 22 Sep 2010 07:35:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-17937.dedibox.fr (sd-17937.dedibox.fr [88.191.100.74]) by mail.postgresql.org (Postfix) with ESMTP id 1635C1337B55 for ; Wed, 22 Sep 2010 04:35:21 -0300 (ADT) Received: from [192.168.10.2] (ASte-Genev-Bois-153-1-56-149.w81-249.abo.wanadoo.fr [81.249.150.149]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id 50F8A3B8F5; Wed, 22 Sep 2010 09:35:21 +0200 (CEST) Message-ID: <4C99B1B8.6040607@lelarge.info> Date: Wed, 22 Sep 2010 09:35:20 +0200 From: Guillaume Lelarge User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); fr; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Nicholas I CC: pgsql-sql@postgresql.org Subject: Re: insert into help References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201009/77 X-Sequence-Number: 34608 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.fr http://dalibo.com