Re: insert into help - Mailing list pgsql-sql

From Guillaume Lelarge
Subject Re: insert into help
Date
Msg-id 4C99B1B8.6040607@lelarge.info
Whole thread Raw
In response to insert into help  (Nicholas I <nicholas.domnic.i@gmail.com>)
Responses Re: insert into help
List pgsql-sql
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;


-- 
Guillaumehttp://www.postgresql.frhttp://dalibo.com


pgsql-sql by date:

Previous
From: Nicholas I
Date:
Subject: insert into help
Next
From: venkat
Date:
Subject: Re: insert into help