进行“加入"就像FQL一样,用于在新闻Feed帖子中获取用户名 [英] running a "join" like FQL for getting a user name along the news feed posts
问题描述
我正在尝试通过以下FQL语句使用FQL获取特定用户的新闻提要中的所有帖子:
I am trying to get all the posts in the news feed for a specific user using FQL using the following FQL statement:
SELECT post_id, actor_id, target_id, message, created_time, updated_time, permalink, description
FROM stream
WHERE filter_key in
(SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed')
AND is_hidden = 0 AND created_time > xxx
但是我需要每个发布新闻的用户的名字(名字和姓氏)出现在我的新闻提要中(该用户名与"actor_id"匹配).
But i need the user name (first and last names) of every user that made a post that appears in my news feed (the user name that is matching the "actor_id").
似乎我无法在FQL中使用加入操作,并且我不想为我的新闻提要中的每个帖子都运行选择操作(可以以以下形式进行数十个额外的调用: "SELECT uid,名称来自用户WHERE uid =).
It seems i cannot user a join operation in FQL and i would not want to run a select operation for every post in my news feed (can be dozens of extra calls in the form of: "SELECT uid, name FROM user WHERE uid=").
有办法克服吗?
推荐答案
您需要使用 FQL Multi-Query 来获取两个结果集:第一个来自流&第二个来自用户.然后,对于第一个结果中的每个结果,在第二个中查找actor_id
.
You need to use a FQL Multi-Query to fetch two result-sets: the first from stream & the second from user. Then for each result in the first one, look up actor_id
in the second.
这篇关于进行“加入"就像FQL一样,用于在新闻Feed帖子中获取用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!