SELECT
a.id, MIN(s.datetime),
MAX(s.datetime),
MIN(s.id)
FROM asdt a
inner join alm al on id = al.id,
sta s
WHERE
a.id not in (select id from alm where distance <= a.radius )
GROUP BY a.id
当查询从上表检查 a.radius 的距离时,由于子查询,此查询运行速度非常慢。