I'm trying to find records from two tables with matching point geometry. The tables have different EPSG types. I do this:
SELECT count(*) FROM t1
WHERE st_intersects(t1.geom, (SELECT st_transform(t2.geom, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', 3008) FROM t2));
but get
ERROR: more than one row returned by a subquery used as an expression
I've also tried:
SELECT count(*) FROM t1
WHERE st_intersects(t1.geom, (SELECT st_transform(t2.geom, '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', 3008) FROM t2 LIMIT 1));
and get 0 rows.
I'm unsure now if there are no matches (it is a possibility here) or if my SQL requries improvement?