Re: INSERT INTO ... SELECT

From: Jonathan Gardner <jgardner(at)jonathangardner(dot)net>
To: Silke Trissl <trissl(at)informatik(dot)hu-berlin(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: INSERT INTO ... SELECT
Date: 2003-08-12 16:40:01
Message-ID: 200308120940.03131.jgardner@jonathangardner.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 11 August 2003 03:21, Silke Trissl wrote:
>
> 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?
>

I'm not too sure on what you want, but I'll guess.

INSERT INTO test_table
(int_id, cust_id, cust_name)
SELECT
1, id, name
FROM customer;

Does this do what you want?

- --
Jonathan Gardner <jgardner(at)jonathangardner(dot)net>
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/ORhhWgwF3QvpWNwRAsoTAJ9Wq+iZ3/JbapXeS1wrv9VgR1gtAgCfVItU
ZsBeXCPBuLuOgBTWn3vu2Gc=
=PJDU
-----END PGP SIGNATURE-----

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jonathan Gardner 2003-08-12 16:42:08 Re: optimisation of a code
Previous Message Christopher Browne 2003-08-12 01:57:05 Re: INSERT INTO ... SELECT