pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tgh002 <arnulfh@gmail.com>
To: pgsql-sql@postgresql.org
Subject: insert into / select from / serial problem
Date: 9 Aug 2005 20:03:47 -0700
Message-ID: <1123643026.939110.310310@g47g2000cwa.googlegroups.com> (raw)

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:
INSERT INTO newtable
SELECT nextval('newtable_id_seq'), field1, field2 FROM anothertable
but that doesnt work

Any ideas?  Greatly appreciated!




view thread (3+ messages)  latest in thread

Message-ID: <1123643026.939110.310310@g47g2000cwa.googlegroups.com>
Permalink:  ../1123643026.939110.310310@g47g2000cwa.googlegroups.com/
Also on:    postgresql.org/message-id/1123643026.939110.310310@g47g2000cwa.googlegroups.com

 · 

reply

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: arnulfh@gmail.com
  Subject: Re: insert into / select from / serial problem
  In-Reply-To: <1123643026.939110.310310@g47g2000cwa.googlegroups.com>

* 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