Re: [GENERAL] Column names for INSERT with query

2013-08-23 Thread David Johnston
Robert James wrote > I would like to: > > INSERT INTO t > SELECT * FROM r, (x + y) AS field3 > > How do I correlate the names of the fields? That is, how do I indicate > which fields from r or field3 should be inserted into the right > columns in t? Already answered but I'll add that as written,

Re: [GENERAL] Column names for INSERT with query

2013-08-22 Thread BladeOfLight16
On Thu, Aug 22, 2013 at 6:36 PM, Ian Lawrence Barwick wrote: > INSERT INTO t (t_field1, t_field2, t_field3) > SELECT r.field1, r.field2, (x+y) > FROM r > Obligatory link to documentation: http://www.postgresql.org/docs/9.2/static/sql-insert.html. See where it says [ ( *column_name* [, ...]

Re: [GENERAL] Column names for INSERT with query

2013-08-22 Thread Ian Lawrence Barwick
2013/8/23 Robert James : > I would like to: > > INSERT INTO t > SELECT * FROM r, (x + y) AS field3 > > How do I correlate the names of the fields? That is, how do I indicate > which fields from r or field3 should be inserted into the right > columns in t? INSERT INTO t (t_field1, t_field2, t_field

Re: [GENERAL] Column names for INSERT with query

2013-08-22 Thread bricklen
On Thu, Aug 22, 2013 at 3:30 PM, Robert James wrote: > I would like to: > > INSERT INTO t > SELECT * FROM r, (x + y) AS field3 > INSERT INTO t (col1, col2, col3) SELECT ...

[GENERAL] Column names for INSERT with query

2013-08-22 Thread Robert James
I would like to: INSERT INTO t SELECT * FROM r, (x + y) AS field3 How do I correlate the names of the fields? That is, how do I indicate which fields from r or field3 should be inserted into the right columns in t? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make c