Re: Updating values of a record variable - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Updating values of a record variable
Date
Msg-id va5jhu0ivgpulpj592n7ith30df3jig91p@4ax.com
Whole thread Raw
In response to Updating values of a record variable  ("Peter Alberer" <h9351252@obelix.wu-wien.ac.at>)
List pgsql-general
On Wed, 26 Jun 2002 10:02:43 +0200, "Peter Alberer"
<h9351252@obelix.wu-wien.ac.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



pgsql-general by date:

Previous
From: Curt Sampson
Date:
Subject: Shared Memory Sizing
Next
From: Saito Yasuhiro
Date:
Subject: Re: Need help on index!!!