SELECT NAME, (6369*3.141592653589793238462643383279502884197169399375105820974944592307 * sqrt((LATITUDE-$latitude) * (LATITUDE-$latitude) + cos(LATITUDE/57.29578) * cos($latitude/57.29578) * (LONGITUDE-$longitude) * (LONGITUDE-$longitude)) / 180) AS distance FROM geonames HAVING distance <= $radius ORDER BY distance ASC As column aliasing doesn't work on ORACLE this query (that works on MySQL) doesn't work - how can I change it to work with ORACLE 10g?