SET @lat1 = 34.0522; SET @lon1 = -118.2437; SET @lat2 = 36.1699; SET @lon2 = -115.1398; SELECT 6371 * 2 * ASIN(SQRT(POWER(SIN((RADIANS(@lat2 - @lat1)) / 2), 2) + COS(RADIANS(@lat1)) * COS(RADIANS(@lat2)) * POWER(SIN((RADIANS(@lon2 - @lon1)) / 2), 2))) AS distance;