1

I am trying to calculate distance between areas by using the answer in this answer but I am not an expert on sql.

The formular is as such

    SELECT * , (3956 * 2 * ASIN(SQRT( POWER(SIN(( $lat - LatOnTable) *  pi()/180 / 2), 2) +COS( $lat * pi()/180) * COS(LatOnTable * pi()/180) * POWER(SIN(( $long - LongOnTable) * pi()/180 / 2), 2) ))) as distance  
from yourTable  
having  distance <= 10 
order by distance

But i am unsure how to get the variables $lat and $long in the formula. My table is layed out below you can see the lat and long highlighted in the table below. How do i retrieve these values and use them in the formula

enter image description here

How do I retrieve these values in my table and use them in the formula?

0 Answers0