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

From John Gage
Subject Putting an aggregate value in an UPDATE statement...
Date
Msg-id 4769D3C0-C894-4CBE-8318-467303665862@numericable.fr
Whole thread Raw
Responses Re: Putting an aggregate value in an UPDATE statement...  (Bret Fledderjohn <freelancer317@gmail.com>)
List pgsql-novice
This statement:


UPDATE question_choices SET total_rows = count(*) from care_lesson;


returns the following error (which is well-documented):


ERROR:  cannot use aggregate function in UPDATE
LINE 1: UPDATE question_choices SET total_rows = count(*) from care_...


I wondered how I can put a row count from one table into another?  I
can't figure it out.

Thanks very much,

John Gage


pgsql-novice by date:

Previous
From: Jeanne Louize Emygdio
Date:
Subject: Invitation to connect on LinkedIn
Next
From: Mariateresa L
Date:
Subject: Re: sql files in psql ?