sqlserver 空间查询提高效率

declare @CityRiver table(geo geometry,riverId int)
insert into   @CityRiver  select Geo,riverId  from 
( select  pr.Shape.STIntersection(ct.Shape) as Geo,cr.OBJECTID as riverId
from Ageo_City ct,Ageo_CityRiver cr,Ageo_ProRiverRange pr
where  1 = 1
and pr.Shape.STIntersects(ct.Shape)=1
and pr.ProRiver = 38
and cr.City = ct.OBJECTID 
and cr.ProvinceRiver = 38 ) as a

select * from @CityRiver cr,Ageo_rainStation rs
where 1 = 1
and cr.geo.STContains(rs.shape) = 1

猜你喜欢

转载自blog.csdn.net/herogui/article/details/84064749