Adnan
Adnan

Reputation: 2996

Query all friends in a network

Is there any way to retrieve all friends in a particular network? For example, How can I view the list of my Facebook friends joined the network of my organization.

Upvotes: 1

Views: 746

Answers (2)

anon
anon

Reputation: 21

I think you can say

SELECT uid, name
FROM user
WHERE
  affiliations.nid = [your network id]
  AND uid IN (SELECT uid2 FROM friend WHERE uid1=[your user id])

Upvotes: 2

mattbasta
mattbasta

Reputation: 13709

You can write an FQL query such as this:

SELECT uid, name FROM user WHERE affiliations.nid = <your network id>

The problem is that affiliations are not indexable, so you would need to have a constraint on either the username, name, or uid column(s) (which kind of defeats the purpose).

So the moral of the story is that if you know the ID of the user or are able to generate a range of users, then you can fetch this data. Otherwise, Facebook pukes on you.

Hope this helps!

Upvotes: 0

Related Questions