Skip to content

Instantly share code, notes, and snippets.

@cgallagher
Last active December 15, 2015 16:59
Show Gist options
  • Save cgallagher/5293000 to your computer and use it in GitHub Desktop.
Save cgallagher/5293000 to your computer and use it in GitHub Desktop.
FQL to find your friends who have iPhones or iOS devices in the Graph API
//find all friends with iOS devices
SELECT uid, name, devices FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND "iOS" IN devices
ORDER BY profile_update_time DESC
LIMIT 0, 100
//find friends with iPhones
SELECT uid, name, devices FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND "iPhone" IN devices
ORDER BY profile_update_time DESC
LIMIT 0, 100
//example
//https://developers.facebook.com/tools/explorer?fql=SELECT%20uid%2C%20name%2C%20devices%20FROM%20user%0AWHERE%20uid%20IN%20(SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me())%0A%20%20AND%20%22iPhone%22%20IN%20devices%0AORDER%20BY%20profile_update_time%20DESC%20%0ALIMIT%200%2C%20100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment