FQL 查询选择就读同一所大学的朋友
因此,我有一个基本的 FQL 查询,可以拉取用户的所有朋友:
$fql = "SELECT name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me())";
我需要能够根据返回的用户的学校来缩小返回用户的范围。我知道你可以做这样的查询:
$fql = "SELECT name FROM user WHERE sex='male' AND uid IN (SELECT uid1 FROM friend WHERE uid2=me())";
这只会返回男性朋友。无论如何,是否要添加另一个子句,例如:
AND WHERE sex='male'
except WHERE a school's id in their info is equal to some other id.我已要求用户授予我 Friends_education_history 权限,因此这应该是一个问题。我想做的就是只拉出来自特定大学的朋友并显示他们。
我还知道教育信息是一个数组。看起来像这样:
( [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 ) ) )
我可以在 type= College 的地方提取信息吗?
提前致谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

SELECT name FROM user WHERE uid IN (SELECT uid1 FROMfriend WHERE uid2=me()) AND 'Utah' IN affiliations
这将拉入网络“Utah”(犹他大学)中的所有朋友。
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).