UPDATE table .....

From: Maik Trömel <maik(dot)troemel(at)maitro(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: UPDATE table .....
Date: 2005-12-13 12:20:45
Message-ID: 439EBC9D.4000409@maitro.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

/Hi,

I want to update a column (integer). The value that should be set is the
sum of the column I want to update and an integer column from another
table with similiar information an the same primary key "gid".

It should work this way:

Table1 + Table2 = Updated Table1
gid var228// gid var228// gid var228/
/1 1 1 3 1
4
2 2 2 2 2
4
3 1 3 7 3
8

I tried some insturctions like:

UPDATE
geom_summen
SET
var228=( SELECT
(geom_summen.var228 + geom_ns_wrf.var228)
FROM
geom_summen, geom_ns_wrf
WHERE
geom_summen.gid=geom_ns_wrf.gid )
WHERE
geom_summen.gid=geom_ns_wrf.gid;

But all of them don't work.
I know it can't be very difficult. But I can't get the solution.
Probably someone can help me.

Thank for help!

Maik
/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pandurangan R S 2005-12-13 12:33:08 Re: UPDATE table .....
Previous Message Sim Zacks 2005-12-13 12:19:07 pg money -> msaccess currency