pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joseph.conway@home.com>
To: Joseph Syjuco <joseph@asti.dost.gov.ph>
To: pgsql-sql@postgresql.org
Subject: Re:
Date: Mon, 3 Sep 2001 10:05:51 -0700
Message-ID: <014d01c1349a$b01727c0$0705a8c0@jecw2k1> (raw)
References: <FHEOJMCOMLCBGLEMAKOGMENPCCAA.joseph@asti.dost.gov.ph>

> im new in postgresql (actually came from SQL Server) and i was trying a
> script like this
>
> insert into table1(field1,field2) values (select field1, field2 from table
> 2);
>
> i dont know if this is possible (inserting a set of entries via resultset
> from a select stmt in one command).  If anyone has any answers, or
> workarounds pls do email me

Well, that syntax doesn't work on SQL Server either.

I think what you want is:
    insert into table1(field1,field2) select field1, field2 from table2;

HTH,

-- Joe






view thread (5+ messages)  latest in thread

Message-ID: <014d01c1349a$b01727c0$0705a8c0@jecw2k1>
Permalink:  ../014d01c1349a$b01727c0$0705a8c0@jecw2k1/
Also on:    postgresql.org/message-id/014d01c1349a$b01727c0$0705a8c0@jecw2k1

 · 

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: joseph.conway@home.com, joseph@asti.dost.gov.ph
  Subject: Re:
  In-Reply-To: <014d01c1349a$b01727c0$0705a8c0@jecw2k1>

* 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