Re: Advice with an insert query

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Advice with an insert query
Date: 2013-06-07 14:26:49
Message-ID: kosqgh$rqj$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message rawi 2013-06-13 11:39:16 Index Usage and Running Times by FullTextSearch with prefix matching
Previous Message Oliver d'Azevedo Cristina 2013-06-07 14:06:58 Re: Advice with an insert query