From: Bob Kruger <bkruger@mindspring.com>
To: pgsql-sql@postgresql.org
Subject: Updating
Date: Wed, 16 Jun 1999 12:06:24 -0500
Message-ID: <3.0.5.32.19990616120624.007e95e0@mindspring.com> (raw)
Thanks for all who assisted with my previous question on grouping.
I would like to do an update of a table with the results of a query on
another.
For example:
table vehcost
id serial
po varchar(12)
veh_no varchar(8)
cost real
comments varchar(30)
table vehinfo
id serial
veh_no varchar(12)
m_cost real
...
I would like to take the sum of vehcost.veh_no and update that info to
field vehinfo.m_cost.
So far, I have worked with the following without success:
update vehinfo set m_cost = (select sum(vehcost.cost) from vehcost group by
veh_no) where vehinfo.veh_no = vehcost.veh_no ;
Any ideas.
Thanks in advance for any assistance.
Regards - Bob Kruger
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: bkruger@mindspring.com
Subject: Re: Updating
In-Reply-To: <3.0.5.32.19990616120624.007e95e0@mindspring.com>
References: <3.0.5.32.19990616120624.007e95e0@mindspring.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