Erro: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* pi() / 180)) * sin((gps_ht_lat * pi() ' at line 9
------------------------------------
SELECT COUNT(*) FROM qry_hoteis_resultado HTL INNER JOIN ( SELECT * FROM ( SELECT gps_ht_id, ( ( ( acos( sin(( * pi() / 180)) * sin((gps_ht_lat * pi() / 180)) + cos(( * pi() /180 )) * cos((gps_ht_lat * pi() / 180)) * cos((( - gps_ht_lon) * pi()/180))) ) * 180/pi() ) * 60 * 1.1515 * 1.609344 ) AS distancia FROM sys_hoteis_gps ) HTL WHERE distancia <= 3 ) T2 ON HTL.ht_id = T2.gps_ht_id WHERE HTL.ht_id > 0 AND HTL.ht_stt IN ('A', 'F') AND (HTL.cid_id = 1522)