Re: UPDATE of several columns using SELECT statement

From: Richard Huxton <dev(at)archonet(dot)com>
To: "adam(dot)slachta" <adam(dot)slachta(at)xitee(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: UPDATE of several columns using SELECT statement
Date: 2009-03-17 15:29:55
Message-ID: 49BFC1F3.8040006@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

adam.slachta wrote:
>
> 1. When trying to update two columns
>
> UPDATE myFirstTable SET (fistCol, secCol) = ( SELECT anotherFistCol,
> anotherSecondCol FROM mySecondTable )

In addition to Sam's reply what you've got there would never work anyway
unless mySecondTable only contains one row. You'd need a join. Like Sam
says though, we don't support that syntax.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2009-03-17 15:31:15 Re: COPY command question
Previous Message Ivano Luberti 2009-03-17 15:28:14 Re: COPY command question