Calculate all latitude and longitude distance in result using MySQL this is my current query to calculate between two latitude and longitude, but how do i using this or similar formula to calculate all the latitude and longitude in result? 

SELECT ROUND(6353 * 2 * ASIN(SQRT( POWER(SIN((a.GPSLat -
      abs(b.GPSLat)) * pi()/180 / 2),2) + COS(a.GPSLat * pi()/180 ) * COS(
      abs(b.GPSLat) *  pi()/180) * POWER(SIN((a.GPSLon - b.GPSLon) *  
      pi()/180 / 2), 2) )), 2) as TotalKM
from table1 a
      inner join table1 b on a.ID = 70 and b.ID = 71;


This example of Lat and Lon in my database



The result count by id70 and id71



Edited : The result that i need is 

(id69 + id70 = 0.4km), 

(0.4km + id71 = 0.7km), 

(0.7km + id72 = 1.0km), 

totalkm is 2.1km 

ID | GPSLAT   | GPSLon     | DistanceInKM
69 | 3.214502 | 101.638419 | 0.0
70 | 3.214478 | 101.638101 | 0.4
71 | 3.214668 | 101.638049 | 0.7
72 | 3.215089 | 101.638022 | 1.0
                           |TotalKM
                             2.1
Add something like this onto the query in order to get the TotalKM

GROUP BY id, gpslat, gpslon WITH ROLLUP


Don't attempt to get that exact output with SQL; do that in you application code.  The ROLLUP will give you an extra line something like

NULL NULL NULL 2.1