Re: Updating values of a record variable

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Peter Alberer" <h9351252(at)obelix(dot)wu-wien(dot)ac(dot)at>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Updating values of a record variable
Date: 2002-06-26 10:32:01
Message-ID: va5jhu0ivgpulpj592n7ith30df3jig91p@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 26 Jun 2002 10:02:43 +0200, "Peter Alberer"
<h9351252(at)obelix(dot)wu-wien(dot)ac(dot)at> wrote:
>It should run thru every row of lr_concepts and count the number of
>related records in the acs_rels table. The value of the count should be
>written into the column "related_lr" of the table lr_concepts.

Peter, try:

UPDATE lr_concepts
SET related_lr = (
SELECT COUNT(*)
FROM acs_rels a
WHERE a.rel_type = 'lr_concept_rel' AND
a.object_id_one = lr_concepts.lr_concept_id);

Servus
Manfred

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Saito Yasuhiro 2002-06-26 12:19:02 Re: Need help on index!!!
Previous Message Curt Sampson 2002-06-26 08:49:15 Shared Memory Sizing