pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Silke Trissl <trissl@informatik.hu-berlin.de>
To: pgsql-sql@postgresql.org
Subject: INSERT INTO ... SELECT
Date: Mon, 11 Aug 2003 12:21:07 +0200
Message-ID: <3F376E13.7080907@informatik.hu-berlin.de> (raw)


Hi,

I would like to insert into a table values from a table and user defined 
ones. Here is the example:

I found this statement to insert values from another table:

INSERT INTO test_table (cust_id, cust_name) SELECT id, name from CUSTOMER;

But the test_table has another column, which should have the same value 
for all the customers.

Is there something like

INSERT INTO test_table (int_id, cust_id, cust_name) '1', SELECT id, name 
from CUSTOMER:

and if so, what ist the correct statement? If not, what is an 
alternative to insert a single row at a time?

Thanks in advance

Silke




view thread (6+ messages)  latest in thread

Message-ID: <3F376E13.7080907@informatik.hu-berlin.de>
Permalink:  ../3F376E13.7080907@informatik.hu-berlin.de/
Also on:    postgresql.org/message-id/3F376E13.7080907@informatik.hu-berlin.de

 · 

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: trissl@informatik.hu-berlin.de
  Subject: Re: INSERT INTO ... SELECT
  In-Reply-To: <3F376E13.7080907@informatik.hu-berlin.de>

* 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