pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: Thrasher <thrasher@fibers.upc.es>
Cc: pgsql-sql@postgresql.org
Subject: Re: Updating from select
Date: Wed, 02 Oct 2002 19:45:44 +0200
Message-ID: <e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com> (raw)
In-Reply-To: <3D9B28B7.4000903@fibers.upc.es>
References: <3D9B28B7.4000903@fibers.upc.es>

On Wed, 02 Oct 2002 19:11:19 +0200, Thrasher <thrasher@fibers.upc.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



view thread (3+ messages)  latest in thread

Message-ID: <e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com>
Permalink:  ../e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com/
Also on:    postgresql.org/message-id/e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mkoi-pg@aon.at, thrasher@fibers.upc.es
  Subject: Re: Updating from select
  In-Reply-To: <e3cmpuka7i9fpuu3o37u99j45plub789cu@4ax.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox