Re: Advice with an insert query - Mailing list pgsql-sql

From Andreas Gaab
Subject Re: Advice with an insert query
Date
Msg-id 48DA836F3865C54B8FBF424A3B775AF66817B178CE@Exchange-Server
Whole thread Raw
In response to Advice with an insert query  (JORGE MALDONADO <jorgemal1960@gmail.com>)
List pgsql-sql

INSERT INTO table1 (fld1, fld2, fl3)

VALUES (SELECT value1, fldx, fldy FROM table2);

 

should work,

 

Andreas

 

 

Von: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] Im Auftrag von JORGE MALDONADO
Gesendet: Freitag, 7. Juni 2013 15:59
An: pgsql-sql@postgresql.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

pgsql-sql by date:

Previous
From: JORGE MALDONADO
Date:
Subject: Advice with an insert query
Next
From: Oliver d'Azevedo Cristina
Date:
Subject: Re: Advice with an insert query