Putting an aggregate value in an UPDATE statement...

From: John Gage <jsmgage(at)numericable(dot)fr>
To: NOVICE Postgres elist <pgsql-novice(at)postgresql(dot)org>
Subject: Putting an aggregate value in an UPDATE statement...
Date: 2010-06-01 20:28:36
Message-ID: 4769D3C0-C894-4CBE-8318-467303665862@numericable.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mariateresa L 2010-06-01 20:33:51 Re: sql files in psql ?
Previous Message Jeanne Louize Emygdio 2010-06-01 12:16:59 Invitation to connect on LinkedIn