Re: aggregate functions are not allowed in UPDATE

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: aggregate functions are not allowed in UPDATE
Date: 2019-01-15 16:58:51
Message-ID: CAKFQuwZBstZizu2rEuB+ML5td2XqYNFMd_StGkaKQ5wCp+rB1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 15, 2019 at 9:52 AM Alexander Farber
<alexander(dot)farber(at)gmail(dot)com> wrote:
>> So calculate the average somewhere else, put the result in a column,
>> and then reference that column in the SET clause.
>>
>
> do you suggest to add a second CTE?

That would qualify as "somewhere else" - as would a simple subquery in FROM.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-01-15 17:17:08 Re: Refining query statement
Previous Message Alexander Farber 2019-01-15 16:52:11 Re: aggregate functions are not allowed in UPDATE