I’m trying to build a PostGIS query that uses an alias of the JOIN statement in the FROM statement, but that is not possible. Is there another way to do it?
SELECT DISTINCT
ST_Buffer(
ST_Centroid(geom),
ST_Area(geom))
FROM building AS b, ST_Transform(sg.geometry, 31467) AS geom
LEFT JOIN surface_geometry AS sg ON b.id = sg.cityobject_id WHERE ST_Area(geom) < 100
You can introduce an extra level of subquery.
So currently you have:
(I changed the indentation to make a bit more sense of it, although I still don’t understand it: you don’t seem to use the values from b anywhere). You need something like: