Re: Column names for INSERT with query - Mailing list pgsql-general

From Ian Lawrence Barwick
Subject Re: Column names for INSERT with query
Date
Msg-id CAB8KJ=hhogt_jhksRFZnJ2xjga2VY3PRXEJsUmwe6b2vZusQuQ@mail.gmail.com
Whole thread Raw
In response to Column names for INSERT with query  (Robert James <srobertjames@gmail.com>)
Responses Re: Column names for INSERT with query  (BladeOfLight16 <bladeoflight16@gmail.com>)
List pgsql-general
2013/8/23 Robert James <srobertjames@gmail.com>:
> 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_field3)
  SELECT r.field1, r.field2, (x+y)
    FROM r


pgsql-general by date:

Previous
From: bricklen
Date:
Subject: Re: Column names for INSERT with query
Next
From: Don Parris
Date:
Subject: Re: Locale Issue