Re: insert into / select from / serial problem

From: PFC <lists(at)boutiquenumerique(dot)com>
To: tgh002 <arnulfh(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: insert into / select from / serial problem
Date: 2005-08-15 07:49:56
Message-ID: op.svjhdiy1th1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 10 Aug 2005 05:03:47 +0200, tgh002 <arnulfh(at)gmail(dot)com> wrote:

> I am using a insert statement like:
>
> INSERT INTO newtable
> SELECT field1, field2 FROM anothertable
>
> newtable structure is: serial, varchar, varchar
>
> What syntax do I use to insert the serial field? Ive tried something
> like:

Try :

INSERT INTO newtable (col1, col2) SELECT field1, field2 FROM anothertable

col1, col2 being the names of your columns that you want to put field1 and
field2 into...

The serial will take care of itself.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-08-15 08:24:38 Re: catch an 'update where false' ?
Previous Message Richard Huxton 2005-08-15 07:25:27 Re: Select problems