Take the 2-minute tour ×

So I have a basic FQL Query that pulls all of the user's friends:

$fql = "SELECT name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me())";

I need to be able to narrow down the returned users depending on their school. I know you can do a query like this:

$fql = "SELECT name FROM user WHERE sex='male' AND uid IN (SELECT uid1 FROM friend WHERE uid2=me())";

And that will return only the male friends. Is there anyway to add another clause like the:

AND WHERE sex='male'

except WHERE a school's id in their info is equal to some other id. I have asked users to grant me the friends_education_history permission so that should be an issue. What I'm trying to do is pull only friends from a specific university and display them.

I also know that the education info is an array. That looks like this:

( [id] => 103767646329157 [name] => Savannah Country Day School ) [year] => Array ( [id] => 137616982934053 [name] => 2006 ) [type] => High School ) [1] => Array ( [school] => Array ( [id] => 110256772337516 [name] => American University Center of Provence ) [type] => College ) [2] => Array ( [school] => Array ( [id] => 12527153330 [name] => University of Virginia ) [year] => Array ( [id] => 142963519060927 [name] => 2010 ) [concentration] => Array ( [0] => Array ( [id] => 154992221223448 [name] => English ) ) [type] => College ) ) )

Could I Pull info where type= College?

Thanks in advance

share|improve this question

1 Answer 1

SELECT name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me()) AND 'Utah' IN affiliations

This will pull in all friends that are in the network "Utah" (University of Utah).

share|improve this answer

Your Answer


