Skip to content

Instantly share code, notes, and snippets.

Avatar

Aroh Sunday melitus

View GitHub Profile
@melitus
melitus / SqlQueryStatement.txt
Last active Apr 9, 2018
I am working on a react redux app with express framework .The app will show users 20 items according to their point of interest within 25 miles to their current location
View SqlQueryStatement.txt
This is the code i have written to obtain the current user geolocation with react redux. I have this sql query to show 20 items according to their point of interest within 25 miles to their current location
```
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) )
* cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin(radians(lat)) ) )
AS distance
FROM shops
HAVING distance < 25
ORDER BY distance
LIMIT 0 , 20;
```