问题描述
简单地说.我需要构建FQL多查询请求的帮助,该请求将执行以下操作:
Simply put. I need help building an FQL multi query request that will do the following:
- 然后从已登录用户的朋友列表中获取UID,
- 使用这些ID抓取过去两周的所有评论和消息(来自信息流)
- 最后,使用用户名将这些结果加入其中
这里是我到目前为止的查询:
Heres the queries I have so far:
[1] GRAB_UID :
SELECT uid2 FROM friend WHERE uid1 = me()
[2] GRAB_STREAM (缺少2周部分,可能完全错了):
[2] GRAB_STREAM (missing the 2 week part and possibly wrong altogether):
SELECT type, created_time, post_id, comments, actor_id, target_id, message
FROM stream
WHERE filter_key IN
(SELECT filter_key FROM stream_filter WHERE uid = me())
AND actor_id IN
(SELECT uid2 FROM friend WHERE uid1 = me())
)';
[3] GRAB_USRNAMES :
SELECT uid, name, username, pic_square, current_location, profile_url
FROM user WHERE uid IN
(SELECT uid2 FROM friend WHERE uid1 = me())
我真的可以使用主人来提出此类请求,我非常感谢您的帮助.
I could really use a master at making these kind of requests and I greatly appreciate the help.
推荐答案
{
"query1":"SELECT uid2 FROM friend WHERE uid1 = me()",
"query2":"SELECT type, created_time, post_id, comments, actor_id, target_id, message FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid = me()) AND actor_id IN (SELECT uid2 FROM #query1)",
"query3":"SELECT uid, name, username, pic_square, current_location, profile_url FROM user WHERE uid IN (SELECT uid2 FROM #query1)"
}
您还可以从以下位置查看Graph API Explorer的结果:
https://developers.facebook.com/tools/explorer?fql={%22query1%22%3A%22SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%22%2C%22query2%22%3A%22SELECT%20type%2C%20created_time%2C%20post_id%2C%20comments%2C%20actor_id%2C%20target_id%2C%20message%20FROM%20stream%20WHERE%20filter_key%20IN%20%28SELECT%20filter_key%20FROM%20stream_filter%20WHERE%20uid%20%3D%20me%28%29%29%20AND%20actor_id%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22%2C%22query3%22%3A%22SELECT%20uid%2C%20name%2C%20username%2C%20pic_square%2C%20current_location%2C%20profile_url%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22}
You can also see the results from the Graph API Explorer at:https://developers.facebook.com/tools/explorer?fql={%22query1%22%3A%22SELECT%20uid2%20FROM%20friend%20WHERE%20uid1%20%3D%20me%28%29%22%2C%22query2%22%3A%22SELECT%20type%2C%20created_time%2C%20post_id%2C%20comments%2C%20actor_id%2C%20target_id%2C%20message%20FROM%20stream%20WHERE%20filter_key%20IN%20%28SELECT%20filter_key%20FROM%20stream_filter%20WHERE%20uid%20%3D%20me%28%29%29%20AND%20actor_id%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22%2C%22query3%22%3A%22SELECT%20uid%2C%20name%2C%20username%2C%20pic_square%2C%20current_location%2C%20profile_url%20FROM%20user%20WHERE%20uid%20IN%20%28SELECT%20uid2%20FROM%20%23query1%29%22}
这篇关于FQL Multiquery编写联接查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!