Table Strcture :-
Create table tbl_locations(Id
int identity(100,1) primary key,Name varchar(100),Address varchar(200),Latitude varchar(50),Longtitude varchar(50)
NOTE - Here latitude = 12.994267 &
longitude = 77.672940.
So you just pass your own.
Select Query
SELECT Id,Name,( 3959 * acos( cos( radians(12.994267) ) * cos( radians( Latitude ) ) * cos( radians( Longtitude ) - radians(77.672940) ) + sin( radians(12.994267) ) * sin( radians( Latitude ) ) ) ) AS Distance FROM tbl_locations ORDER
BY Distance
No comments:
Post a Comment