开发者

SQLite query compare distance within rows

I would like to compare and get only stations which are within a distance range ONE TO THE OTHER. Let say I have 3 stations A-B-C they all have a position x-y-z. I would like to get the stations that are distant from 30 meters (I have a function to compute the distance so let's call it distance(x,y)).

SELECT * FROM Station WHERE distance(Station1, Station2) < 30

My problem is how can you compare distance of two different rows Station1 and Station开发者_开发百科2?

Thanks!!!


You could do something like this:

select a.*
from station a
inner join station b
on distance(a.station_id, b.station_id) < 30;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜