Re: Putting an aggregate value in an UPDATE statement... - Mailing list pgsql-novice

From Leif Biberg Kristensen
Subject Re: Putting an aggregate value in an UPDATE statement...
Date
Msg-id 201006012315.13986.leif@solumslekt.org
Whole thread Raw
In response to Re: Putting an aggregate value in an UPDATE statement...  (John Gage <jsmgage@numericable.fr>)
List pgsql-novice
On Tuesday 1. June 2010 23.03.51 John Gage wrote:
> Thanks.  I tried that _without_ the parentheses around the select
> statement and it didn't work.
>
> At the risk of further displaying ignorance, why are the parens
> necessary, what do they do?

I don't know the technical answer, but as an intuitively derived rule of
thumb: Whenever you need the output of a subselect in an outer query, put the
subselect in parentheses. It becomes second nature after a while.

regards,
--
Leif Biberg Kristensen
http://solumslekt.org/blog/

pgsql-novice by date:

Previous
From: John Gage
Date:
Subject: Re: Putting an aggregate value in an UPDATE statement...
Next
From: Tom Lane
Date:
Subject: Re: Putting an aggregate value in an UPDATE statement...