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 '), 2) + POW(69.1 * ( - lng) * COS(lat / 57.3), 2)) AS distance From airports' at line 2 Select airports.iata, airports.lat, airports.lng, airports.city_id, lang_airports.name, SQRT( POW(69.1 * (lat - ), 2) + POW(69.1 * ( - lng) * COS(lat / 57.3), 2)) AS distance From airports, lang_airports Where airports.id IN () and airports.id = lang_airports.airport_id and lang_airports.lang_id = '60' ORDER BY distance limit 0, 5