pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Barwick <barwick@gmx.net>
To: Vangelis-Maria Tougia <tougias@cytanet.com.cy>
To: pgsql-sql@postgresql.org
Subject: Re: UPDATE table SET col = (SELECT ...)
Date: Thu, 26 Jun 2003 23:11:10 +0200
Message-ID: <200306262311.10435.barwick@gmx.net> (raw)
In-Reply-To: <LPBBJCOFLNPHLEKEIJJFKEMACCAA.tougias@cytanet.com.cy>
References: <LPBBJCOFLNPHLEKEIJJFKEMACCAA.tougias@cytanet.com.cy>

On Wednesday 25 June 2003 11:00, Vangelis-Maria Tougia wrote:
> Hi,
> I found follwing email sent to you in internet.
> I am interested in same issue myself.
> Did you finally found out any more information about how to Update a column
> of a table by selecting value from another table?

Not sure if this has been answered previously, but here goes:

> Hello,
>
> If I understand the SQL references I have read, UPDATEs are allowed to
> pull data from SELECT statements, something like
>
>   UPDATE table SET col1 = (SELECT val1 FROM table WHERE id = 34),
>                SET col2 = (SELECT val2 FROM table WHERE id = 34)
                 ^^^
>          WHERE id = 35;

The second "SET" is not necessary or allowed and is causing the update to
fail.


Ian Barwick
barwick@gmx.net





view thread (3+ messages)

Message-ID: <200306262311.10435.barwick@gmx.net>
Permalink:  ../200306262311.10435.barwick@gmx.net/
Also on:    postgresql.org/message-id/200306262311.10435.barwick@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: barwick@gmx.net, tougias@cytanet.com.cy
  Subject: Re: UPDATE table SET col = (SELECT ...)
  In-Reply-To: <200306262311.10435.barwick@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox