I have just one table of street segments of Berlin (OSM Data, imported using osm2po, SRID set to 25833). I want my query to output all street segments, that are within a certain distance (e.g. 2000m) of those segments which have the attribute clazz of 11 (motorways).
I've tried this query:
SELECT id, clazz FROM berlin_2po_4pgr WHERE NOT clazz = '11' AND ST_DWithin( (SELECT geom_way WHERE clazz = '11'), geom_way, 2000);
My output is empty (for any given distance). Why? Is it because of wrong use of the Subselect?