mardi 15 décembre 2015

Postgis: How do I transfer the data of an specific element, when I test for a different element?

I want to test within which geometry from vg250_krs the geometries from vg250_gem are and then I want data (i.e. 'bez') of that geometry from wg250_krs to be added to the table element 'krsbez' of the first geometry. So far I figured out:

UPDATE vg250_gem
SET krsbez = vg250_krs.bez
FROM vg250_krs

WHERE ST_Within(vg250_gem.geom,geom)=true 

But right now, all the rows of the column 'krsbez' from vg250_gem just adapt the data from the first element of 'vg250_krs.bez' and NOT the data of the exact geometry within which they are.

How do I specify the SET to the exact element? Do I need to test my 'WHERE...' before SETting? I tried it with an If-condition but failed.

Aucun commentaire:

Enregistrer un commentaire