Last active
August 29, 2015 14:07
-
-
Save khaeransori/8c785df237a4ea97f003 to your computer and use it in GitHub Desktop.
query menghitung jarak dengan koordinat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT *, | |
| ( | |
| 3959 | |
| * acos( cos( radians( {$lat} ) ) | |
| * cos( radians( `lat` ) ) | |
| * cos( radians( `long` ) | |
| - radians( {$long} ) ) | |
| + sin( radians( {$lat} ) ) | |
| * sin( radians( `lat` ) ) ) | |
| * 1.609344 | |
| ) AS `jarak` | |
| FROM `tbl_restoran` | |
| ORDER BY `jarak` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment