Is there a way to use FQL to select all my friends Checkins that are in range of a specified location? I can use FQL to return my friends checkin coords:
https://api.facebook.com/method/fql.query?access_token={0}&query=SELECT coords FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
but how can I add to the above query to do something like...
Where coords Within 10 miles of [(New York City, NY) | (long, lat) | (user.current_location)]
Any help would be greatly appreciated. Thanks in advance.
EDIT (3/9 3:05pm est):
I'm mainly just looking for an end result - doesn't need to get everything back in a single FQL statement, or even use FQL (graph api, possibly?) I understand I may need to bring it back data back in pieces and work with it locally due to the limitations of FQL/the graph api. I just want to do it in an efficient manner so a user doesn't have to wait 20secs for everything to load.
The immediate problem is that if someone has several hundred friends and all checkins for each friend are returned, that's too much data to work with.
The granular details of the result I'm looking for is to start with all my friends, and end up with the top 10 places (based of highest frequency of the checkin's location ID) they checked into within the last X days, that are within Y distance of the users current facebook location, and where the location's page falls into a certain category, like a bar.
That's the scenario I'm dealing with and I hope the additional information I appended doesn't complicate my original question. Thanks!