Skip to content

Instantly share code, notes, and snippets.

@pjf
Created September 11, 2009 12:46
Show Gist options
  • Save pjf/185278 to your computer and use it in GitHub Desktop.
Save pjf/185278 to your computer and use it in GitHub Desktop.
Selecting all friends who are interested in a particular hobby should be easy, right?
Well, it is, provided you're happy to do subselects, and realise the hobbies come back as a giant string.
Luckily, all that hard work can be pushed off to the FQL server...
---
SELECT name
FROM user
WHERE uid IN (
SELECT uid2
FROM friend
WHERE uid1 = '$me'
)
AND (
strpos(activities, '$hobby') >= 0 OR
strpos(interests, '$hobby') >= 0
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment