Re: INSERTS and Queries

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: C G <csgcsg39(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERTS and Queries
Date: 2004-03-01 13:56:46
Message-ID: 4043411E.3070401@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

C G wrote:
> Dear All,
>
> I can use insert with 'select' if I do this
>
> INSERT INTO TABLE t1 (col1) SELECT stuff FROM t2;
>
> But I want to insert more than one thing into the table, e.g.
>
> INSERT INTO TABLE t1 (col1,col2) SELECT stuff FROM t2 , 100;
>
> Any ideas on how I would achieve this?

INSERT INTO TABLE t1 (col1, col2) SELECT stuff, morestuff FROM t2;

If you want to instert some constant:

INSERT INTO TABLE t1 (col1, col2) SELECT stuff, 100 FROM t2;

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Beutin 2004-03-01 15:01:35 ORDER BY problem
Previous Message Nick Barr 2004-03-01 13:49:16 Re: INSERTS and Queries