I have several point tabels, lets say 3. Tables are alike with two columns: a integer value and a geometry like:
- table sand1 (value int, geom geometry)
- table sand2 (value int, geom geometry)
- table sand3 (value int, geom geometry)
I need to join the three tables to a new table with four columns like: valueTab1, valueTab2, valueTab3, geometry.
The join has to be on the point geometry. The value field cannot be used since it is a measurement value. Some of the points are positioned directly on top of each other. The ST_Equals points then results in one record.
So the picture above with three layers sand1 (three records), sand2 (two records) and sand3 (three records) should produce a new table with four columns and four records.
Columns:
sand1Value, sand2Value, sand3Value, geom
Records:
22, null, null, null, geom
null, 31, 37, null, geom
1111, null, 66, geom
11, 44, 55, geom
I have tried joining with ST_Equals(sand1.geom, sand2.geom), but ST_Equals does only take two parameters. Have tried the tablefunc extension with crosstab and multiple joins on like WHERE ST_AsText(sand1.geom) IN (ST_AsText(sand2.geom), ST_AsText(sand3.geom))