-1

我如何计算此查询中满足条件距离的记录。请帮助:)

"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"
4

1 回答 1

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 . " "
于 2012-11-03T10:01:30.530 回答