Skip to content

Instantly share code, notes, and snippets.

View melitus's full-sized avatar

Aroh Sunday melitus

View GitHub Profile
@melitus
melitus / SqlQueryStatement.txt
Last active April 9, 2018 21:08
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
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;
```