Created
September 27, 2012 08:41
-
-
Save jamiepittock/3792933 to your computer and use it in GitHub Desktop.
This file contains 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 ct.entry_id, ct.title, ct.url_title, cd.field_id_344 as cf_places_latitude, cd.field_id_345 as cf_places_longitude, ROUND( '3959' * acos( cos( radians('51.494737') ) * cos( radians( cd.field_id_344 ) ) * cos( radians( cd.field_id_345 ) - radians('-0.146358') ) + sin( radians('51.494737') ) * sin( radians( cd.field_id_344 ) ) ), '2' ) AS distance | |
FROM exp_channel_data as cd | |
LEFT JOIN exp_channel_titles as ct ON ct.entry_id = cd.entry_id | |
WHERE ct.channel_id IN ('2') | |
AND ct.entry_id != '12' | |
HAVING distance < '1' | |
ORDER BY distance desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment