[ad_1]

I have a data that looks like this:

```
name | Lat | long |
A | 1.0 | 20.0 |
B | 2.1 | 21.0 |
C | 3.0 | 22.0 |
D | 4.0 | 23.0 |
```

*these are just sample data.

I need to know what is the distance of the column “name” from each other using their lat-long

Now, I found the formula on how to get the distance using lat-long, but now I need to determine which is my end lat-long and my start lat-long to compare the distance, to get this I have to generate a result like this:

```
startName |startLat | startLong | endName | EndLat | endLong |
A | 1.0 | 20.0 | B | 2.1 | 21.0 |
A | 1.0 | 20.0 | C | 3.0 | 22.0 |
A | 1.0 | 20.0 | D | 4.0 | 23.0 |
B | 2.1 | 21.0 | A | 1.0 | 20.0 |
B | 2.1 | 21.0 | C | 3.0 | 22.0 |
B | 2.1 | 21.0 | D | 4.0 | 23.0 |
```

Or, any suggestion for an easier way to get the distance aside from this would be really helpful.

[ad_2]