Updating

Поиск
Список
Период
Сортировка
От Bob Kruger
Тема Updating
Дата
Msg-id 3.0.5.32.19990616120624.007e95e0@mindspring.com
обсуждение исходный текст
Список pgsql-sql
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




В списке pgsql-sql по дате отправления:

Предыдущее
От: José Soares
Дата:
Сообщение: Re: [SQL] date
Следующее
От: Ravneet Mann
Дата:
Сообщение: help needed