pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Advice with an insert query
Date: Fri, 07 Jun 2013 16:26:49 +0200
Message-ID: <kosqgh$rqj$1@ger.gmane.org> (raw)
In-Reply-To: <CAAY=A7-4fNtC-6akfvfBw2VmqAS0B5+bVxHktWg2qMztV21KEA@mail.gmail.com>
References: <CAAY=A7-4fNtC-6akfvfBw2VmqAS0B5+bVxHktWg2qMztV21KEA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
JORGE MALDONADO, 07.06.2013 15:58:
> I need to insert records into a table where one value is fixed and 2 values come from a SELECT query, something like the following example:
>
> INSERT INTO table1 fld1, fld2, fl3
> VALUES value1, (SELECT fldx, fldy FROM table2)
>
> Is this valid?
>
> Respectfully,
> Jorge Maldonado
INSERT INTO table1 (fld1, fld2, fl3)
SELECT value1, fldx, fldy
FROM table2
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (4+ messages)
Message-ID: <kosqgh$rqj$1@ger.gmane.org>
Permalink: ../kosqgh$rqj$1@ger.gmane.org/
Also on: postgresql.org/message-id/kosqgh$rqj$1@ger.gmane.org
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: spam_eater@gmx.net
Subject: Re: Advice with an insert query
In-Reply-To: <kosqgh$rqj$1@ger.gmane.org>
* 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