Update a table from another table - Mailing list pgsql-novice

From Jason Tan Boon Teck
Subject Update a table from another table
Date
Msg-id AANLkTik5yLqzacXgwtki5z3fTeacMZ2cROkkzAe3yEpi@mail.gmail.com
Whole thread Raw
Responses Re: Update a table from another table  (Andreas <maps.on@gmx.net>)
List pgsql-novice
Hi,


I am trying to update tableA with records from tableB, in a single SQL
statement, along the lines of

INSERT INTO tablea SELECT * FROM tableb;

but doing UPDATE instead. The manual says

UPDATE [ ONLY ] table [ [ AS ] alias ]
    SET { column = { expression | DEFAULT } |
          ( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
    [ FROM from_list ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

I am having trouble defining the SET part of the statement. The table
has many columns. Is there a wild card or something.

Thanks in advance.


--
Jason Tan Boon Teck

pgsql-novice by date:

Previous
From: Joshua Tolley
Date:
Subject: Re: PgFouine
Next
From: Andreas
Date:
Subject: Re: Update a table from another table