Re: Advice with an insert query

From: Andreas Gaab <A(dot)Gaab(at)scanlab(dot)de>
To: 'JORGE MALDONADO' <jorgemal1960(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Advice with an insert query
Date: 2013-06-07 14:01:19
Message-ID: 48DA836F3865C54B8FBF424A3B775AF66817B178CE@Exchange-Server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

INSERT INTO table1 (fld1, fld2, fl3)
VALUES (SELECT value1, fldx, fldy FROM table2);

should work,

Andreas

Von: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] Im Auftrag von JORGE MALDONADO
Gesendet: Freitag, 7. Juni 2013 15:59
An: pgsql-sql(at)postgresql(dot)org
Betreff: [SQL] Advice with an insert query

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver d'Azevedo Cristina 2013-06-07 14:06:58 Re: Advice with an insert query
Previous Message JORGE MALDONADO 2013-06-07 13:58:51 Advice with an insert query