pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wilco Boschman <w.boschman@xs4all.nl>
To: pgsql-sql@postgresql.org
Subject: Re: Insert values from one existing table into a new table.
Date: Tue, 13 Nov 2001 22:33:03 +0100
Message-ID: <3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl> (raw)
References: <9srij6$gre$1@cronkite.temple.edu>

Assuming that the structure of the tables are identical, you could do a:

insert into new_table
  select * from some_table;

If they are not the same you could do a:

insert into new_table (column1, column2)
  select column1, column2 from some_table;

Cheers,

Wilco Boschman


"Jason" <jzhu@dental.temple.edu> schreef in bericht
news:9srij6$gre$1@cronkite.temple.edu...
| I want to insert the existing values of one table into a new table.  It
| needs the combination of  these to sql commands:
|
| "  insert into new_table values ( values_of_AtrributeA,
| values_of_AttributesB) "
| " select AttributeA, AttributeB from some_table "
|
| Thanks for your suggestions!  -- Jason
|
|
|





view thread (4+ messages)  latest in thread

Message-ID: <3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl>
Permalink:  ../3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl/
Also on:    postgresql.org/message-id/3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl

 · 

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: w.boschman@xs4all.nl
  Subject: Re: Insert values from one existing table into a new table.
  In-Reply-To: <3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl>

* 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