RE: subqueries as values in updates

From: "Francis Solomon" <francis(at)stellison(dot)co(dot)uk>
To: <patrick(dot)jacquot(at)anpe(dot)fr>, "liste SQL" <pgsql-sql(at)postgresql(dot)org>
Subject: RE: subqueries as values in updates
Date: 2000-12-08 11:30:12
Message-ID: NEBBIFFPELJMCJAODNPKIEKOCDAA.francis@stellison.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

The syntax you used works fine for me.

francis=# select version();
version
---------------------------------------------------------------
PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc 2.95.2
(1 row)

Hope this helps

Francis Solomon

> -----Original Message-----
> From: pgsql-sql-owner(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of
> patrick(dot)jacquot(at)anpe(dot)fr
> Sent: 08 December 2000 13:00
> To: liste SQL
> Subject: [SQL] subqueries as values in updates
>
>
> hello, list.
> are subqueries alloved as values in an update command ?
> e.g.
>
> update a set a.attribute1 = a.attribute1 +
> (select sum(b.attribute1) from b where b.attribute2=a.attribute2);
>
> If yes, how is the correct syntax ?
> If not, is there a hope for it in a future version ?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message patrick.jacquot 2000-12-08 13:00:25 subqueries as values in updates
Previous Message Joseph Shraibman 2000-12-08 04:23:07 FOREIGN KEY errors.