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
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