I have two polygonal layers: "existing" and "modified".
Attribute table of "existing" and "modified" layers have same column "feature_id" - number of feature. Please help me create query which write attributes 't' (if features matches) and 'f' (if features not matches) in 'compare_result' column of "modified" layer using ST_Equals function.
Now I receive attributes 't' (if features matches) and 'f' (if features not matches) in pgAdmin result window using query:
SELECT ST_Equals(modified.the_geom, existing.the_geom) AS compare_result FROM modified, existing
WHERE modified.feature_id=existing.feature_id
but I don't can create query? which write result in attribute table. Thanks!
EDIT: Solution without creating additional layer:
UPDATE
modified
SET
compare_result = compare_result_temp
FROM
(
SELECT
r."feature_id" AS idmodified,
ST_Equals(r.the_geom, m.the_geom) AS compare_result_temp
FROM
"modified" AS r,
"existing" AS m
WHERE r."feature_id" = m."feature_id"
) AS foo
WHERE
foo.idmodified = modified."feature_id";