如何计算此查询中的记录,这些记录满足条件距离。请帮助:)
"SELECT
( 6371 * acos( cos( radians({$dane['lat']}) ) * cos( radians(o.lat ) ) * cos( radians(o.lng ) - radians({$dane['lng']}) ) + sin( radians({$dane['lat']}) ) * sin( radians(o.lat ) ) ) ) AS distance
,COUNT(*)
FROM ogloszenia o
$where
GROUP BY o.id
HAVING distance<$promien"
答案 0 :(得分:0)
"SELECT
( 6371 * acos( cos( radians({$dane['lat']}) ) * cos( radians(o.lat ) ) * cos( radians(o.lng ) - radians({$dane['lng']}) ) + sin( radians({$dane['lat']}) ) * sin( radians(o.lat ) ) ) ) AS distance
,COUNT(*)
FROM ogloszeniao
where
GROUP BY o.id
HAVING distance<" . $promien . " "