SELECT districtid, char_length(districtid) as d_length FROM district
where ST_Intersects(geometry, ST_GeometryFromText('LINESTRING (119.922 30.526, 120.168 30.596)'))
查询出来的结果:
接下来我怎么将最长length的行过滤出来,这张图片里面是length为9的行。
现在我用的是with
语句:
With dis AS
(SELECT districtid, char_length(districtid) as d_length FROM district
where ST_Intersects(geometry, ST_GeometryFromText('LINESTRING (119.922 30.526, 120.168 30.596)')) )
Select * From dis where d_length=(select max(d_length) from dis);
有没有其他更好的方法?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…