Re: Updating from select

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Thrasher <thrasher(at)fibers(dot)upc(dot)es>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Updating from select
Date: 2002-10-02 17:45:44
Message-ID: e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 02 Oct 2002 19:11:19 +0200, Thrasher <thrasher(at)fibers(dot)upc(dot)es>
wrote:
>UPDATE trans_log t SET t.cost =
> (SELECT SUM(p.cost) FROM products_log p WHERE p.trans = t.id)

Thrasher, try it without the table alias t:

UPDATE trans_log SET cost =
(SELECT SUM(p.cost) FROM products_log p
WHERE p.trans = trans_log.id)

Servus
Manfred

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message bcschnei 2002-10-02 17:53:29 Re: Stored Procedures
Previous Message Beth Gatewood 2002-10-02 17:11:31 Re: indexing on char vs varchar