Hi,
I have a select statement that uses a spatial index that works okay but when I then expand the statement to join with another table I get an error "No such colum 'ROWID'".
This is the one that works:
SELECT l.pk_uid
FROM spt_LandPolygons AS l
WHERE
ROWID IN (
SELECT ROWID FROM SpatialIndex WHERE(( f_table_name = 'spt_LandPolygons' )
AND ( search_frame = MakePoint( -2, 52 ) ))
AND ST_Contains( l.lpolygon , MakePoint( -2,52) )
);
And then I get my coordinate from another table and is where I get the error:
SELECT l.pk_uid
FROM spt_LandPolygons AS l
JOIN spt_Polygons AS p
WHERE
p.id = 6666
AND ROWID IN (
SELECT ROWID FROM SpatialIndex WHERE(( f_table_name = 'spt_LandPolygons' )
AND ( search_frame = ST_Centroid( p.polygon ) ))
AND ST_Contains( l.lpolygon , ST_Centroid( p.polygon ))
);
Is there a way to qualify the table ROWID is from?
The two tables of spt_LandPolygons and spt_Polygons are actually in two different .db files but I've attached the two databases. I don't think this is the problem but please let me know if you think it might be.
Any other thoughts most welcome.
Best, Chris