INSERT INTO ... SELECT

From: Silke Trissl <trissl(at)informatik(dot)hu-berlin(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: INSERT INTO ... SELECT
Date: 2003-08-11 10:21:07
Message-ID: 3F376E13.7080907@informatik.hu-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2003-08-11 10:24:07 sub-sel/group problem
Previous Message Bertrand Petit 2003-08-11 09:37:56 Re: Comparing arrays