Search Postgresql Archives

UPDATE table .....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



/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
/


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux