UPDATE table ..... - Mailing list pgsql-general

From Maik Trömel
Subject UPDATE table .....
Date
Msg-id 439EBC9D.4000409@maitro.net
Whole thread Raw
Responses Re: UPDATE table .....
List 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
/

pgsql-general by date:

Previous
From: Sim Zacks
Date:
Subject: pg money -> msaccess currency
Next
From: Pandurangan R S
Date:
Subject: Re: UPDATE table .....